About Me

My photo
Hi Friends, I am Sandeep CC and some people know me as System Administrator. I have started my professional career from 2008. I have been working as System Administrator on Linux Server and Windows Client. I am here to share my Knowledge in which I have experienced and which I have come across till now, It could be help to you people. In case anything wrong or any improvements in my post steps, Please comment to the post, Feel free to contact me by posting comments on this blog. Thanks and Regards, Sandeep CC

Thursday, March 13, 2014

Configure Roundcube webmail on CentOS 6.5 / Redhat Linux

Configure Roundcube webmail on CentOS 6.5 / Redhat Linux


Introduction:  Roundcube is interface for webmail sever, which offers more features & user-friendly like  send-receive mails, calenders, marking, folder, adressbook and much more,  roundcube can be installed/configure on any OS platform (windows, linux, mac etc...). This required some basic configurations which we are going to discuss...I feel roundcube is better than squirrelmail to use/access mails (Its depend on people's choice )...for squirrelmail configuration Click Here

Requirement: (Need some service's to be run, installation steps given below links)
1. Roundcube binary files
2. Webserver (httpd) (Click Here)
3. Mysql (mysqld) (Click Here)
4. Php  (httpd) (Click Here)
5. Dovecot & Sendmail (Click Here)
6. DNS (Click Here)

Downloads:
Roundcube binary files: (Download) or (Download)

Basic Setup:
Setup host name and ip address (static), we must required to configure httpd, mysqld, dovecot, sendmail & named service's (for configuration of this service's, provided links above). modify below files(before modifying any files take a backup copy for your safer side),

1. Host name : /etc/sysconfig/network
[root@mailsvr ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=mailsvr.com
[root@mailsvr ~]#

2. IP : /etc/sysconfig/network-scripts/ifcfg-eth0 (You can add eth1 as public static IP for access from internet)
[root@mailsvr ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
HWADDR=MACID
#IPV6INIT="yes"
#NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
IPADDR=192.168.5.1
NETMASK=255.255.255.0
GATEWAY=192.168.5.1
DNS1=192.168.5.1
IPV6INIT=no
USERCTL=no
[root@mailsvr ~]#

3. cat /etc/resolv.conf
[root@mailsvr ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search com
nameserver 192.168.5.1
nameserver static public dns provided by ISP

4. cat /etc/hosts
[root@mailsvr ~]# cat /etc/hosts (do not remove localhost ip name)
127.0.0.1       localhost.localdomain   localhost.localdomain   localhost4      localhost4.localdomain4 localhost
::1     localhost.localdomain   localhost.localdomain   localhost6      localhost6.localdomain6 localhost
192.168.5.1      mailsvr.com         mail
[root@mailsvr ~]#

5. create users by using useradd passwd commands

6. Make necessary changes in dovecot files cd /etc/dovecot/ & cd /etc/dovecot/conf.d/ directory files (Dovecot config files are different in rhel/centos 5/6 and rhel/centos 6/6.5 versions...

7. Firewall/iptables disable, SElinux disable, to work on iptables open port no - 80, 443, 143, 25

Create Database:
[root@mailsvr ~]# mysql -u root -p
Enter password:

mysql> CREATE DATABASE roundcubemail;
Query OK, 1 row affected (0.01 sec)

mysql> GRANT ALL PRIVILEGES ON roundcubemail.* TO roundcubemail@localhost IDENTIFIED BY 'roundcubemail123';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

Installation of Roundcube:

Extract downloaded roundcube directory
[root@mailsvr Downloads]# tar -xvf roundcubemail-0.9.5.tar.gz

Move Extracted directory to /var/www/html
[root@mailsvr Downloads]# mv roundcubemail-0.9.5 /var/www/html

Change Directory Name (Keep name as we can access easily in web browser Exp: http://localhost/mails)

[root@mailsvr Downloads]# cd /var/www/html/
[root@mailsvr html]# mv roundcubemail-0.9.5 mails

Set Permission for /tmp & /logs directory (Better to change all directory and sub directory ownership by root:apache , its optional , actually not required to change , its just for troubleshooting issue if it is not working)

[root@mailsvr mails]# chown -R apache:apache temp/
[root@mailsvr mails]# chown -R apache:apache logs/

[root@mailsvr mails]# ls -ltr |egrep "logs|temp"
drwxr-xr-x  2 apache  apache  4096 Feb 26 12:58 temp
drwxr-xr-x  2 apache  apache  4096 Feb 26 12:58 logs
[root@mailsvr mails]#

Now open browser in server, give  http://localhost/mails/installer or http://192.168.5.1/mails/installer , There you will find 3 setup pages on top, you must need to complete 1st page then only you can go with 2nd page then 3rd last page. Keep in mind you must need to give created mysql db and pass correctly, Give all correct information, after 1st page compilation you have to download 2 files(2 files screen shot has given below) and keep that files in /var/www/html/mails/config/ path then continue on 3rd page (if you wont copy this file in particular path then you may get error for 3rd page). given below screen shot of 3 pages by modifying/adjusting...

Page-1
Installer Page - 1





Page -2

Installer Page - 2


Page -3
Installer Page - 3

Note: At the end of this configuration you must need to remove/move installer directory from /.../mails/ and move to somewhere. /.../mails/config/main.inc.php files as given below...

[root@mailsvr mails]# mv installer/ /home/
[root@mailsvr mails]# cd config/
[root@mailsvr config]# vi main.inc.php
$rcmail_config['enable_installer'] = false; -----------------> by default its true make it false.

after removing and disabling this installer option check it again in browser by giving same url http://192.168.5.1/mails/installer it should not work, final intention is our webmail server should not hack or access/modify by someone else who is not authorize person to touch this server, it should give error link below image.

After removing /installer/ directory
After disable installer option,
before removing /installer/ directory














Now your roundcube has configured completely, now you can access this webmail server by giving ip/name in browser http://192.168.5.1/mails , user name - password created in server


Mail Server in browser
User logged in
Thanks and Regards,
Sandeep CC