Installing PostfixAdmin and RoundCube

This note tells how to install the mailbox management tool - PostfixAdmin, and a convenient interface for reading mail - RoundCube, on a server running CentOS Linux.

First article: Installing and configuring Postfix
Second article: Installing and configuring an imap/pop3 service based on Dovecot

I strongly recommend reading them.

First install the packages we need:

yum -y install httpd php-mysql php-common php php-mail php-imap php-mbstring php-Mcrypt php-mcrypt php-dom php-intl pam  mod_ssl openssl crypto-utils setuptool wget

1. Installing PostfixAdmin

Download postfixadmin:

wget http://downloads.sourceforge.net/project/postfixadmin/postfixadmin/postfixadmin-2.91/postfixadmin-2.91.tar.gz

1.1. Unpack it and copy it to the /usr/share folder:

tar xf postfixadmin-2.91.tar.gz
mv postfixadmin-2.91 /usr/share/postfixadmin

1.2. Change the folder owner to the user Apache runs as:

chown -R apache:apache /usr/share/postfixadmin

1.3. Edit the Apache configuration. Then restart Apache so the changes take effect:

echo "Alias /postfixadmin /usr/share/postfixadmin" >> /etc/httpd/conf.d/mail.conf
/etc/init.d/httpd reload

1.4.*** Create the database for storing the mail, if you do not have one. If the database exists - go to step 1.5. Keep in mind that **postfix and postfixadmin have to work with the same database.

1.4.1. Connect to mysql as root, create the database and the user:

mysql -uroot -p
create database mail;
grant all privileges on mail.* to postfix@localhost identified by 'password';

1.4.2. Go to your site in the browser and type at the end of the address /postfixadmin/setup.php
http://domainname.com/postfixadmin/setup.php

1.5.***** If your postfix is already configured to work with a database, then you need to put its parameters into the postfixadmin config file.

1.5.1. For that open the /usr/share/postfixadmin/config.inc.php file in your favourite editor and enter the configuration parameters:

$CONF['database_type'] = 'mysqli';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'postfix';
$CONF['database_password'] = 'password';
$CONF['database_name'] = 'mail';

1.5.2. Change the $CONF['configured'] value to true after you enter the database settings.

1.5.3. Go to your site in the browser and type at the end of the address /postfixadmin/upgrade.php
http://domainname.com/postfixadmin/upgrade.php

After you enter the setup password and create the administrator, PostfixAdmin will work at the link.
http://domainname.com/postfixadmin/

2. Installing RoundCube

Download roundcube:

wget http://downloads.sourceforge.net/project/roundcubemail/roundcubemail/1.0.1/roundcubemail-1.0.1.tar.gz

2.1. Unpack it and copy it to the /usr/share folder:

tar xf roundcubemail-1.0.1.tar.gz
mv roundcubemail-1.0.1 /usr/share/roundcubemail

2.2. Change the folder owner to the user Apache runs as:

chown -R apache:apache /usr/share/roundcubemail

2.3. Create a copy of the example config:

cp /usr/share/roundcubemail/config/config.inc.php.sample /usr/share/roundcubemail/config/config.inc.php

2.4. Create the database and the mysql user:

mysql -uroot -p
create database roundcubemail;
grant all privileges on roundcubemail.* to roundcube@localhost identified by 'password';

2.5. Edit the Apache configuration. Then restart Apache so the changes take effect

echo "Alias /roundcubemail /usr/share/roundcubemail" >> /etc/httpd/conf.d/mail.conf
/etc/init.d/httpd reload

2.6. In the browser go to the address:
http://domainname.com/roundcubemail/installer/

After all the manipulations are done RoundCube will work.