July 2007


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@localhost
IDENTIFIED 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.php
cp 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!

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 :D ) 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:

  1. NTFS

  2. NTFS

  3. NTFS

  4. 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 :D .

That’s all there is to it.

Cheers!