All my blogs are now hosted on http://jangestre.blogpsot.com
July 30, 2007
Installing Roundcube on FreeBSD 6.1
Posted by jangestre under FreeBSD | Tags: FreeBSD 6.1, Roundcube Webmail |1 Comment
Installing Roundcube on FreeBSD 6.1
This installation was done way back last year 2006 when I was still working for a government agency, I built this mail server for them. I had a free hand to choose whatever operating system I want so I chose FreeBSD, it was my first installation of FreeBSD and when I did it the release version was 6.1.
I will not discuss here about slices and partitioning and how I installed FreeBSD, instead I will discuss what applications are needed to be installed in order for Roundcube Webmail to work properly.
The following are the needed applications and how to install them:
Install MySQL:
# cd /usr/ports/databases/mysql41-server
# make install clean
# mysql_install_db
Change ownership of mysql directory:
# chown -R mysql /var/db/mysql/
# chgrp -R mysql /var/db/mysql/
Start MySQL server:
# /usr/local/bin/mysql_safe -user=mysql &
Note: If you encounter command not found error, just issue the command rehash.
# rehash
Make an initial my.cnf file by copying any of the examples:
# cp /usr/local/share/mysql/my-large.cnf /var/db/mysql/my.cnf
Install Apache 2.2:
# cd /usr/ports/www/apache22
# make install clean
Enable it at bootup:
# echo 'apache22_enable=”YES”' >> /etc/rc.conf
I used the default DocumentRoot which is located in /usr/local/www/apache22/data directory.
Install Dovecot:
# cd /usr/ports/mail/dovecot
# make install clean
Enable it at bootup:
# echo 'dovecot_enable=”YES”' >> /etc/rc.conf
We need to have a dovecot.conf file so copy the example.
# cd /usr/local/etc
# cp dovecot.conf.example dovecot.conf
# chmod u+w dovecot.conf
Edit dovecot.conf and add the following:
# vi dovecot.conf
ssl_disable = no
default_mail_env = maildir:/usr/home/%u/Maildir
Take note that default_mail_env can take an empty value, I chose the value above because it’s the settings I have in my Debian box.
Install Postfix:
# cd /usr/ports/mail/postfix-current
# make install clean
Note: You have to enable SASL2 and TLS fo security reasons.
Install PHP4 and PHP4-extensions:
# cd /usr/ports/lang/php4
# make install clean
# cd /usr/ports/lang/php4-extension
# make config
# make install clean
Note: If you’re going to use amavisd-new and postgrey, the application p5-BerkeleyDB is needed. This is how to install it.
# pkg_add -vr db41
# make install WITH_BDB_VER=41
Install SASL authentication daemon:
# cd /usr/ports/security/cyrus-sasl2-saslauthd
# make install clean
Enable it at bootup:
# echo 'saslauthd_enable=”YES” >> /etc/rc.conf
# echo 'saslauthd_flags=”-a getpwent”' >> /etc/rc.conf
Install RoundCube:
I used svn to download and install roundcube based on fak3r’s howto.
Go to your Apache’s DocumentRoot:
# cd /usr/local/www/apache22/data
Checkout Roundcube using subversion:
# svn checkout https://svn.roundcube.net/trunk
Move the roundcubemail directory to your DocumentRoot, remove the ‘trunk’ directory and then change into the rouncubemail directory:
# mv trunk/roundcubemail .# rm -rf trunk# cd roundcubemail
Set permissions of the temp and logs dir so that the web user can read/write to them
# chown -R www:www temp logs
Create a database for storage of Roundcubemail data, replace $PASSWORD with the password you want the roundcube user to use to access mySQL.
Note: The initial mysql server install root password is blank, you must change this!
# mysql -u root -p> create database 'roundcubemail';> GRANT ALL PRIVILEGES ON roundcubemail.* TO roundcube@localhostIDENTIFIED BY '$PASSWORD';> quit
Import the inital Roundcubemail SQL
# mysql roundcubemail < SQL/mysql.initial.sql
Change into the config directory
cd config
Copy the config *php.dist files to *.php
cp db.inc.php.dist db.inc.phpcp main.inc.php.dist main.inc.php
Modify the config files to suit your environment. In db.inc.php you only need to change the database definition line, add your password in place of $PASSWORD
$rcmail_config['db_dsnw'] = 'mysql://roundcube:PASSWORD@localhost/roundcubemail';
Assuming your mailserver is running on the same physical box as the webserver, disable database caching
$rcmail_config['enable_caching'] = FALSE;
define the host as localhost
$rcmail_config['default_host'] = 'localhost';
define smtp as localhost
$rcmail_config['smtp_server'] = 'localhost';
and increase the session lifetime from 5 to something more reasonable (optional)
$rcmail_config['session_lifetime'] = 30;
Launch a web browser and point it to
http://some.url/roundcubemail
Then login with a valid/existing IMAP username and password, since I did not use any table lookup for postfix, my roundcube users are the system users I’ve added using useradd utility and since they’re not going to use any shell, I disabled their login.
That’s all there is to it.
Cheers!
July 29, 2007
Installing Solaris 10 on a x86 box
Posted by jangestre under Solaris | Tags: i386, Solaris 10 |1 Comment
Howto Install Solaris 10 on a x86 machine.
My machine’s specification:
Intel Celeron 1.8 Ghz
384 MB RAM
2 100 GB Hard drive
NVIDIA TNT RIVA 32MB
Dual boot Windows XP and CentOS 5
Although I have experience installing Linux and FreeBSD, this is my first attempt to install Solaris on my x86 box which has Windows XP and CentOS 5 installed, since I have no more space to accommodate all three OS, I had to overwrite the Linux partition with Solaris. First thing I noticed upon booting into the CD installer is the GRUB boot loader, I thought Solaris has its own boot loader, anyways I pressed <Enter> to immediately load Solaris, so let’s begin.
The first screen will ask you to choose what installation mode you like, I chose [1] which is Solaris Interactive, since I only have 384MB of RAM I was notified that it needs at least 400MB of RAM to proceed with the graphical installation so I had to bear with the text based interactive install. Next screen says it’s beginning system identifcation, waited several minutes for this part to finish then on with the next screen which will ask you to select a language.
I chose [0] which is English then the Solaris Installation Program screen loads informing you that there will no mouse (text based , what do you expect
) then press F2 to continue. Next screen will load saying that it’s identifying the system ( networked or non-networked, time zone, date and time), press F2 again to continue
Enter Hostname:
home.solaris.local
Press F2 to continue and the next screen will ask you to confirm the information you entered, press F2 again to continue
Time Zone:
move to choose your time zone using the arrow keys and press spacebar to enable it, again press F2 to continue
Country or Region:
Highlight the country using the arrow key and press the spacebar to enable it, press F2 to continue
Date and Time:
Press F2 again to confirm and continue, after that the screen to enter them machine’s root password appears, you have to enter the password twice and press F2 to continue, the next screen says Identifying the system again?, press F2 again to continue, it will then ask you to enable remote services, just accept the default which is “yes” then press F2 again to continue, the Solaris Interactive Installation screen loads, press F2 to select Standard then it will ask you whether you want the CD installer to eject automatically, choose automatic which is the default ( This didn’t work, the CD didn’t eject automatically, too bad!). After this, the Reboot After Installation screen loads, choose automatic which is the default, one thing you have to do is to remove the CD installer before rebooting or else the entire installation process repeats! Press F2 then F2_OK to continue.
Solaris Interactive Installation screen loads and since I already installed Solaris before I wrote this Howto it presented two options, i.e, asking you whether to F2_upgrade or F4_fresh-install, I chose F4 other it should be just F2 fresh install. Then initialization begins…License screen loads and you have to accept the license of course! Then Select Geographic Region < North America> then press F2 to continue and select System Locale, just accept the default POSIX C © , again press F2 to continue and select products, I just pressed F2 to continue, Additional Products screen loads, just press F2 to continue then the Select Software screen loads, I chose the default Entire Distribution ( I want to tinker the whole nine yards).
Partitioning > Select Disk partitioning and since I have two drives I was presented with these options:
-
c0d0
-
c0d1
You will notice that it is entirely different from what you and me are used to, in Solaris you ought to know about “Slices” too same thing I’ve experienced with FreeBSD, slices overcome the deficiencies of the partitioning scheme which Linux and Windows are using i.e., you can only create four primary partitions. Inside the each slice, you can create as many partitions as you like, now back with the installation, since I would like to dual boot Windows and Solaris, I allocated the last partition on my first drive to accommodate Solaris, this is how I done it.
After customizing my hard drive using fdisk, the following is my partitioning layout:
-
NTFS
-
NTFS
-
NTFS
-
SOLARIS <- before this filesystem was created, I deleted the last partition and the created a new one with the SOLARIS filesystem.
Press F2 again and again to continue, when you arrive at the auto-layout filesystem screen, just press F2 to automatically layout the filesystem, again press F2 to continue until you reached the screen wherein you will be asked to review the choices you made on previous screens, then after reviewing, press F2 to begin the installation.
I waited for several minutes until I was greeted that the installation succeeded, this is where the install process should have automatically ejected the CD but sadly it didn’t so I ejected it manually, the machine rebooted and GRUB loads, press Enter or wait ten seconds to load Solaris, the kdmconfig X Server Selection screen loads asking which X server do you want to install, Xsun or Xorg, I chose Xsun and press F2 to continue and the next screen loads telling me to view and edit Window system configuration, I chose “No Changes needed, test/save and exit” then pressed F2 again to continue, Window System Configuration test page loads, press F2 to test and click Yes if OK.
It will then ask you if you need to override system’s default NFS version 4, just accept the default which is [No]. Then Starting Solaris Installation Launcher in Commad line mode loads:
Insert CD2 then Select Media [1], press Enter and press c to continue, repeat these process for the remaining CD’s (5 CD). It took me almost two hours to finish this installation process( that long huh!), then it will ask you to reboot the machine, then Solaris starts to load and now I am presented with the Login Screen, I entered root as username as mysecret as password respectively and I was asked to choose whether to load the Java Desktop 3 or CDE, I chose JDS3 for this, afterwards the GUI loads, one thing I’ve noticed is that JDS3 is just GNOME stable version.
Now you might be wondering why am logging in as root and not as an ordinary user, well there was no ordinary user created during installation because that’s the way Sun wants it! You have to create an ordinary user using smc ( Sun Management Console) or the useradd utility but too bad, smc didn’t worked for me, it’s always telling me that the wbem might not be running so I need to restart the wbem service and restart smc but to no avail, so I decided to go with the good old utility useradd but I encountered another problem using useradd, it won’t create the user that I need to create, so I’ve googled for reasons why it isn’t working and I came across this article that /etc/auto_home and /etc/auto_master needs to be edited and all configuration should be commented out in order for the useradd utility to work properly, after making the modifications to the said file, I rebooted the machine and open a shell and created my desired users using this format:
# useradd -d /export/home/user1 -s /usr/bin/bash -m user1
and used the passwd command to change the password for the user, you will noticed that the user’s home directory resides on /export/home/username instead of /home/username, this is how Solaris filesystem was designed so if you have questions, ask them not me
.
That’s all there is to it.
Cheers!
June 14, 2007
My First Encounter with Windows 3.11
Posted by jangestre under Windows | Tags: Windows 3.11 |Leave a Comment
My boss’ wife recently brought a laptop to the office and she asked me if I could clean it up by deleting unwanted and personal files and fixed it because the mouse isn’t working. So I asked her what OS is installed on the laptop, I was in awe when she said Windows 3.11 and I said “Ohh, really? a working 14 year old laptop, now imagine that” it’s an EPSON laptop, I didn’t know that EPSON was making laptops during the old days, I thought they’re just into printers manufacturing.
It’s a good thing when I looked at the mouse port and I noticed it is using PS, thank God, I thought I will have difficulty in finding a working mouse
I plugged it on the power outlet and started the machine and Windows started loading, when it was done, all I saw was a desktop with no start button, the experience was a little bit strange because I am used to using the recent Windows version. Imagine menu’s are located on the desktop so when I double click one application and loads, the desktop menu for that application will disappear and will only appear when you close the application, I wonder what will happen if I deleted that menu, hehe, I didn’t even bother to try because my boss’ wife intends to sell it in ebay.
June 9, 2007
Installation and configuration of MRTG on RHEL 4.
1. Download and install mrtg, use up2date or via rpm.
2. Make sure that the net-snmp-utils package was installed, check by:
# rpm -q net-snmp-utils
If it’s not installed, use up2date or rpm command to install.
3. Check if snmp is running properly, the community string is usually named public, change this according to your preference.
# snmpwalk -v 1 -c public localhost interface
The result is somehow similar to this output:
IF-MIB::ifDescr.1 = STRING: lo IF-MIB::ifDescr.2 = STRING: eth0 IF-MIB::ifDescr.3 = STRING: eth1 IF-MIB::ifPhysAddress.1 = STRING: IF-MIB::ifPhysAddress.2 = STRING: 0:9:5b:2f:9e:d5 IF-MIB::ifPhysAddress.3 = STRING: 0:b0:d0:46:32:7
4. Configure SNMP.
Save the old configuration file.
# cd /etc/snmp
# mv snmpd.conf snmpd.conf.orig
# vi snmpd.conf
Enter the following line in the new configuration file to set the Read Only community string to public.
rocommunity public
Configure Linux to start SNMP services on each reboot with the chkconfig command.
# chkconfig snmpd on
Start SNMP to load the current configuration file.
# service snmpd start
Test whether SNMP can read the system and interface MIBs using the snmpwalk command.
# snmpwalk -v 1 -c public localhost system
SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost.kanati.com.ph 2.6.9-42.0.10.ELsmp #1 SMP Fri Feb 16 17:13:42 EST 2007 x86_64 SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 SNMPv2-MIB::sysUpTime.0 = Timeticks: (178700) 0:29:47.00 SNMPv2-MIB::sysContact.0 = STRING: Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
# snmpwalk -v 1 -c public localhost system
IF-MIB::ifNumber.0 = INTEGER: 8 IF-MIB::ifIndex.1 = INTEGER: 1 IF-MIB::ifIndex.2 = INTEGER: 2 IF-MIB::ifIndex.3 = INTEGER: 3 IF-MIB::ifIndex.4 = INTEGER: 4 IF-MIB::ifIndex.5 = INTEGER: 5 IF-MIB::ifIndex.6 = INTEGER: 6 IF-MIB::ifIndex.7 = INTEGER: 7 IF-MIB::ifIndex.8 = INTEGER: 8 IF-MIB::ifDescr.1 = STRING: lo IF-MIB::ifDescr.2 = STRING: eth0 IF-MIB::ifDescr.3 = STRING: eth1 IF-MIB::ifDescr.4 = STRING: eth2 IF-MIB::ifDescr.5 = STRING: eth3
Now edit snmpd.conf, this is my snmpd.conf
# First, map the community name "public" into a "security name"
# sec.name source community
# com2sec notConfigUser default public
com2sec local localhost public
com2sec network_1 192.168.168.0/24 public
com2sec network_2 10.17.19.0/24 public
com2sec kanati 123.456.78.9 public
####
# Second, map the security name into a group name:
# groupName securityModel securityName
#group notConfigGroup v1 notConfigUser
#group notConfigGroup v2c notConfigUser
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyROGroup1 v1 network_1
group MyROGroup1 v2c network_1
group MyROGroup2 v1 network_2
group MyROGroup2 v2c network_2
group MyROGroup3 v1 kanati
group MyROGroup3 v2c kanati
#### # Third, create a view for us to let the group have rights to: # Make at least snmpwalk -v 1 localhost -c public system fast again. # name incl/excl subtree mask(optional) view all included .1 view systemview included .1.3.6.1.2.1.1 view systemview included .1.3.6.1.2.1.25.1.1 #### # Finally, grant the group read-only access to the systemview view. # group context sec.model sec.level prefix read write notif #access notConfigGroup "" any noauth exact all none none access MyROGroup1 "" any noauth exact all none none access MyROGroup2 "" any noauth exact all none none access MyROGroup3 "" any noauth exact all none none access MyRWGroup "" any noauth exact all all none # -----------------------------------------------------------------------------
5. Configuring MRTG
Use MRTG’s cfgmaker command to create a configuration file named mrtg.cfg for the server using a Read Only community string of public. Place all data files in the directory /var/www/mrtg.
# cfgmaker --output=/etc/mrtg/mrtg.cfg --global "workdir: /var/www/mrtg" -ifref=ip --global 'options[_]: growright,bits' public@localhost
--base: Get Device Info on public@localhost: --base: Vendor Id: --base: Populating confcache --snpo: confcache public@localhost: Descr lo --> 1
....
--base: Walking ifOperStatus --base: Writing /etc/mrtg/mrtg.cfg
Run MRTG using /etc/mrtg/mrtg.cfg as your argument three times. You’ll get an error twice as MRTG tries to move old data files, and naturally, the first time it is run, MRTG has no data files to move.
# env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
Use MRTG’s indexmaker command to create a Web index page using your new mrtg.cfg file as a guide. The MRTG Web GUI expects to find the index file in the default MRTG Web directory of /var/www/mrtg/, so the format of the command would be.
# indexmaker --output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg
MRTG is run every five minutes by default, and the file that governs this is /etc/cron.d/mrtg. For MRTG to work correctly, edit this file, replacing all occurrences of /usr/bin/mrtg with
env LANG=C /usr/bin/mrtg
The RHEL 4 MRTG installation process creates a cron file named /etc/cron.d/mrtg. This file tells the cron daemon to run MRTG using the /etc/mrtg/mrtg.cfg file every five minutes to poll your network devices.
Let’s add other things to monitor such as CPU and Memory. The following is my configuration to query CPU and memoy usage.
#
# File: /etc/mrtg/server-stats.cfg
#
# Configuration file for non bandwidth server statistics
#
#
# Define global options
#
LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt,/usr/share/snmp/mibs/TCP-MIB.txt
workdir: /var/www/mrtg/
#
# CPU Monitoring
# (Scaled so that the sum of all three values doesn't exceed 100)
#
Target[server.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public@localhost + ssCpuRawSystem.0&ssCpuRawSystem.0:public@localhost + ssCp
uRawNice.0&ssCpuRawNice.0:public@localhost
Title[server.cpu]: Server CPU Load
PageTop[server.cpu]: <H1>CPU Load - System, User and Nice Processes</H1>
MaxBytes[server.cpu]: 100
ShortLegend[server.cpu]: %
YLegend[server.cpu]: CPU Utilization
Legend1[server.cpu]: Current CPU percentage load
LegendI[server.cpu]: Used
LegendO[server.cpu]:
Options[server.cpu]: growright,nopercent
Unscaled[server.cpu]: ymwd
#
# Memory Monitoring (Total Versus Available Memory)
# Target[server.memory]: memAvailReal.0&memTotalReal.0:public@localhost Title[server.memory]: Free Memory PageTop[server.memory]: <H1>Free Memory</H1> MaxBytes[server.memory]: 100000000000 ShortLegend[server.memory]: B YLegend[server.memory]: Bytes LegendI[server.memory]: Free LegendO[server.memory]: Total Legend1[server.memory]: Free memory, not including swap, in bytes Legend2[server.memory]: Total memory Options[server.memory]: gauge,growright,nopercent kMG[server.memory]: k,M,G,T,P,X # # Memory Monitoring (Percentage usage) # Title[server.mempercent]: Percentage Free Memory PageTop[server.mempercent]: <H1>Percentage Free Memory</H1> Target[server.mempercent]: ( memAvailReal.0&memAvailReal.0:public@localhost ) * 100 / ( memTotalReal.0&memTotalReal.0:public@ localhost ) options[server.mempercent]: growright,gauge,transparent,nopercent Unscaled[server.mempercent]: ymwd MaxBytes[server.mempercent]: 100 YLegend[server.mempercent]: Memory % ShortLegend[server.mempercent]: Percent LegendI[server.mempercent]: Free LegendO[server.mempercent]: Free Legend1[server.mempercent]: Percentage Free Memory Legend2[server.mempercent]: Percentage Free Memory
Test server-stats.cfg configuration.
# service snmpd restart # env LANG=C /usr/bin/mrtg /etc/mrtg/server-stats.cfg
Create a new MRTG index file to include the server-stats.cfg file
# indexmaker --output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg /etc/mrtg/server-stats.cfg
Configuring Crond to use the new MRTG file, To do so, add this line to your /etc/cron.d/mrtg file:
0-59/5 * * * * root env LANG=C /usr/bin/mrtg /etc/mrtg/server-stats.cfg
Restart the cron daemon.
# service crond restart
That’s all there is to it, were done!