Friday, December 19, 2014

How to Install Roundcube Webmail on Linux/CentOs

Server Requirements:-

    * Apache webserver
    * PHP Version 5.2.1 or greater
    * MySQL, PostgreSQL, SQLite or MSSQL database
    * An IMAP server which supports IMAP4 rev1
    * An SMTP server (recommended) or PHP configured for mail delivery

    * OS - CentOs

Installation Procedure:

     Download the latest stable version of RoundCube web mail from and copy it to your web server.

Link :

1) Roundcube Webmail installation:

Login to your Apache server host through shell (putty)
Un tar roundcubemail-0.3.1.tar.gz in the web root directory

# tar -xvzf roundcubemail-0.3.1.tar.gz -C /var/www/html/
# cd /var/www/html
# mv roundcubemail-0.3.1/ roundcubemail
# cd roundcubemail/

RoundCube needs to save some temp files and it also writes logs. Therefore make sure that the following directories (temp,logs) are writable by the web server user

#chown -R apache.apache logs temp


2) Mysql configuration:

Login to your mysql server through shell (or webmin) and Create a database for your webmail (You can use the same server for both Apache and MySQL)

Example: db name - roundcubedb, username - roundcubeuser , password - roundcubepwd (your choice)

#mysql -u root -p ( enter the mysql root password)
mysql> create database 
mysql> grant all privileges on 
roundcubedb.* to roundcubeuser@localhost identified by 'roundcubepwd';
mysql> exit

Above commands will create a database roundcubedb with the required permissions.
If you are ruining Apache and mysql in different servers, you have to grand privilege for roundcubeuser@apacheserverip.
Now import the table layout

#mysql roundcubedb < SQL/mysql.initial.sql  -u root -p
(enter the root password or mysql server)
Create the config file from samples

#cd config/

Edit Database Configuration File:

Edit the file and replace the below lines with your database access details

$rcmail_config['db_dsnw'] = 'mysql://roundcubeuser:roundcubepwd@localhost/roundcubedb';

3) Apache Server Configuration:

DNS Configuration:
Add dns entry for your support website ( to 192.168.1.X (replace with your ip) )
If you don't have dns server already running, you can use the ip directly

Edit Apache Config:

edit /etc/httpd/conf/httpd.conf and add the following configurations
< VirtualHost* >
DocumentRoot /var/www/html/roundcubemail
RewriteEngine on
RewriteRule .* - [F]
    < Directory "/var/www/html/roundcubemail"  >
        DirectoryIndex index.php
    < /Directory >
Options ExecCGI
< /VirtualHost >

If you don't have DNS server you can skip the above step

and add alias for this mail directory

#vim /etc/httpd/conf/httpd.conf

Alias /webmail "/var/www/html/roundcubemail"

Restart apache server

Other wise add the roundcubemail document path here : 
#vim /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html/roundcubemail"

#service httpd restart

4) Installer config:

Edit file and enable the installer and check all the required modules are present, php config, etc

# vim
$rcmail_config['enable_installer'] = true;

Now you can Point your browser to http://url-to-roundcube/installer/ (http://192.168.1.X/webmail/installer).

After checking this installer script you can disable  the installer 

$rcmail_config['enable_installer'] = false;

Now you can start using your webmail through browse 
your webmail url  or ip (from remote computer)
If no dns server configured , use alias http://192.168.1.X/webmail ( from local host http://localhost/webmail)

Here you can enter your username, password, mail server details and start browsing your mails 

You can start using the webmail with the above configuration itself. Below I have mentioned optional configurations. 

A) Customizing the Configuration

IMAP server configuration:
By default the login screen provides a text box where you need to enter the IMAP host which you want to connect to. If you dont want your users to enter the mailserver details, you can hide this by setting one fixed IMAP host address
$rcmail_config['default_host'] = 'yourmailserverip';
$rcmail_config['smtp_server'] = 'yourmailserverip';

If you want to add multiple servers
$rcmail_config['default_host'] = array(
  '' => 'Default Server',
  '' => 'Webmail Server',
  'ssl://' => 'Secure Webmail Server'

Deleted messages:

Some mail clients just mark messages as deleted and finally remove them when leaving the application. RoundCube by default move messages to the Trash folder when hitting the delete button. However this behavior can be changed by unsetting the 'trash_mbox' property and enabling 'flag_for_deletion'. Your configuration could look like this:
$rcmail_config['trash_mbox'] = '';
$rcmail_config['flag_for_deletion'] = true;
$rcmail_config['skip_deleted'] = false;

Messages will now be marked as deleted which can be reverted again. To finally remove them, the user needs to click "Compact" below the folder list. 

B) Other Configurations:

To use RoundCube with PostgreSQL support you have to follow these
simple steps, which have to be done as the postgres system user (or
which ever is the database superuser):
$ createuser roundcube
$ createdb -O roundcube -E UNICODE roundcubemail
$ psql roundcubemail
roundcubemail =# ALTER USER roundcube WITH PASSWORD 'the_new_password';
roundcubemail =# \c - roundcube
roundcubemail => \i SQL/postgres.initial.sql

All this has been tested with PostgreSQL 8.x and 7.4.x. Older
versions don't have a -O option for the createdb, so if you are
using that version you'll have to change ownership of the DB later. - See more at:


No comments:

Post a Comment