Wednesday, January 6, 2016

Roundcube Webmail installation


Overview:
Roundcube is a web-based IMAP email client written in the PHP programming language. Till now the latest released version is roundcube 0.8.4.

Server Requirements:
    * Apache or Lighttpd 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.

Installation Procedure:
Install all required packages follow the bellow steps:
#yum install httpd*
#yum install php*
#yum install mysql*

For SMTP, here I am using postfix mail server:
# yum install postfix

For IMAP here I am using dovecot:
# yum install dovecot

Note: if you have already mail server and imap server configure no need to do above 2 steps.

Prerequisites:
1. Already installed and configured sendmail or postfix mail server.
2. Already configured and running DNS server.

Now Download the latest stable version of RoundCube web mail from http://www.roundcube.net  and copy it to your web server using winscp or other preferred method.

1) Roundcube Webmail installation:
Login to your apache server host through root credential.
Untar 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

Configuration:
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)
Here I am using same server for both.
In first time, you will get this error:



To resolve this, do this:
# /etc/init.d/mysqld restart



Then login mysql server with your credential, in mysql default root password is not set, you can set it using command

# mysqladmin  -u root password  ‘newpassword’
# mysql   -u  root   -p



My database information like
db name - roundcubedb,
username - roundcubeuser ,
password - roundcubepwd (your choice)

Now Create database
mysql> create database roundcubedb;
mysql> grant all privileges on roundcubedb.* to roundcubeuser@localhost identified by 'roundcubepwd';
mysql> FLUSH PRIVILEGES;
mysql> exit

You can see your database is created using command
mysql > show databases;



Above commands will create a database “roundcubedb” with the required permissions.

Note: If you are ruining apache and mysql in different servers, you have to grant  privileges for roundcubeuser@apacheserverip (in our case it is not required).

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/
# cp   db.inc.php.dist     db.inc.php
# cp    main.inc.php.dist    main.inc.php

Database Configuration:
Edit the db.inc.php file and replace the below lines with your database access details
# vim db.inc.php

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

3) Apache Server Configuration:
Edit “/etc/httpd/conf/httpd.conf” and add the following configurations (as in screenshots)
<VirtualHost 192.168.1.130:*>
DocumentRoot /var/www/html/roundcubemail
ServerName roundcube.example.com
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
    <Directory "/var/www/html/roundcubemail">
        DirectoryIndex index.php
    </Directory>
Options ExecCGI
</VirtualHost>



Note: you may have some problem in writing the line “RewriteCond”. It.d be better if you simply copy and paste the whole “virtual host” block into your httpd.conf file.

Restart the http service:



4) Installer config:
Edit main.inc.php file and enable the installer and check all the required modules are present, php config, etc
# vim /var/www/html/roundcube/config/main.inc.php
$rcmail_config['enable_installer'] = true;

Now you can Point your browser to http://roundcube.example.com/roundcubemail/installer/ (http://192.168.1.130/roundcubemail/installer)

Note:-Here you need to make some following changes in your system and config file, for successfully run the installer.

1. In first time you get date.timezone: NOT OK
Set your local time zone and edit the /etc/php.ini file

# vim /etc/php.ini
Uncomment the line date.timezone =          and give your time zone info



Restart httpd service
# /etc/init.d/httpd restart
# chkconfig httpd on
# chkconfig mysqld on

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 don’t want your users to enter the mailserver details, you can hide this by setting one fixed IMAP host address

# vim main.inc.php
$rcmail_config['default_host'] = 'localhost';
$rcmail_config['smtp_server'] = 'localhost';





Now click on next you will get 3 screen

After checking this installer script you can disable the installer
# vim main.inc.php
$rcmail_config['enable_installer'] = false;

And also move your installer  directory to the roundcubemail directory to another place.

Now you start using your webmail through browse
your webmail url http://roundcube.example.com or ip.
Here you can enter your username, password, details and start browsing your mails.





5 comments:

  1. Hello! I simply wish to offer you a big thumbs up for the great information you have here on this post.
    I'll be returning to your site for more soon.

    ReplyDelete
  2. I think this is one of the most important info for me.
    And i'm glad reading your article. But want to remark
    on few general things, The site style is perfect, the articles is really
    great : D. Good job, cheers

    ReplyDelete
  3. My partner and I stumbled over here by a different web page and
    thought I should check things out. I like what I see so i am just following you.
    Look forward to exploring your web page yet again.

    ReplyDelete
  4. I for all time emailed this website post page to all my associates, as if like to read it after that my contacts will too.

    ReplyDelete
  5. I went over this website and I believe you have a lot of fantastic info, saved to my
    bookmarks (:.

    ReplyDelete