CentOS Sendmail Roundcube Configuration Tutorial
CentOS Sendmail Roundcube Configuration Tutorial
Hi all, There is tons of tutorials available in the internet. While i was in a position to install a sendmail server, i found no difficulty in finding documentations. But i had a thought of integrating all in one place. It might be more useful for someone on some day. Your comments and suggestions are welcome. My server is centos 5 Install Sendmail and Dovecot
Code:
[root@sendmail ~]# yum install sendmail* [root@sendmail mail]# yum install dovecot
Code:
[root@sendmail ~]# rpm -qa|grep sendmail sendmail-8.13.8-2.el5 sendmail-cf-8.13.8-2.el5 sendmail-doc-8.13.8-2.el5 sendmail-devel-8.13.8-2.el5
Code:
[root@sendmail ~]# sendmail -d0.1 -bv Version 8.13.8 Compiled with: DNSMAP HESIOD HES_GETMAILHOST LDAPMAP LOG MAP_REGEX MATCHGECOS MILTER MIME7TO8 MIME8TO7 NAMED_BIND NETINET NETINET6 NETUNIX NEWDB NIS PIPELINING SASLv2 SCANF SOCKETMAP STARTTLS TCPWRAPPERS USERDB USE_LDAP_INIT ============ SYSTEM IDENTITY (after readcf) ============ (short domain name) $w = sendmail (canonical domain name) $j = sendmail.example.com (subdomain name) $m = example.com (node name) $k = sendmail.example.com ========================================================
Configuration
Code:
[root@sendmail mail]# cd /etc/mail/ [root@sendmail mail]# vi local-host-names
this file will contain the domain names for which the send mail server is going to serve
Code:
# local-host-names - include all aliases for your machine here. example.com
Code:
[root@sendmail mail]# vi sendmail.mc
Code:
dnl # Following line is optional. If you want ot relay the mails through another server, use the next line define(`SMART_HOST', `relayserver.example.com')dnl dnl # dnl # The following allows relaying if the user authenticates, and disallows dnl # plaintext authentication (PLAIN/LOGIN) on non-TLS links dnl # dnl define(`confAUTH_OPTIONS', `A p')dnl dnl # dnl # PLAIN is the preferred plaintext authentication method and used by dnl # Mozilla Mail and Evolution, though Outlook Express and other MUAs do dnl # use LOGIN. Other mechanisms should be used if the connection is not dnl # guaranteed secure. dnl # Please remember that saslauthd needs to be running for AUTH. dnl # TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl dnl # The following causes sendmail to only listen on the IPv4 loopback address dnl # 127.0.0.1 and not on any other network devices. Remove the loopback dnl # address restriction to accept email from the internet or intranet. dnl # dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
This step is also optional. If relay server need an authentication provide the credantials here
Code:
[root@sendmail mail]# vi access
Code:
AuthInfo:relay.dnsexit.com "U:USERNAME" "P:PASSWORD" "M:PLAIN"
Code:
[root@sendmail mail]# useradd -s /sbin/nologin senthil [root@sendmail mail]# passwd senthil Changing password for user senthil. New UNIX password: BAD PASSWORD: it is too short Retype new UNIX password: passwd: all authentication tokens updated successfully.
Map the mails for users. This will be required when more number of users and more domains are hosted in the same server [CODE] Code:
[root@sendmail mail]# vi virtusertable
Code:
[email protected] senthil
Configure Dovecot
Code:
[root@sendmail mail]# vi /etc/dovecot.conf
Code:
protocols = imap pop3
Code:
[root@sendmail mail]# m4 sendmail.mc > sendmail.cf [root@sendmail mail]# make
Code:
[root@sendmail mail]# /etc/init.d/sendmail start [root@sendmail mail]# /etc/init.d/saslauthd start [root@sendmail mail]# /etc/init.d/dovecot start
Code:
[root@sendmail mail]# chkconfig sendmail on [root@sendmail mail]# chkconfig dovecot on [root@sendmail mail]# chkconfig saslauthd on
As of now the sendmail server is ready. The server can be accessed by outlook or any mail client. It will be very nice if are having a imap webmail client. I prefer Roundcube. The previous version of Roundcube was having some security holes(Before 2 years). But the current stable version seems to be secured. Round cube requires mysql support and php greater than 5.2.0. The current version of Php is 5.1.6 so have to update php version. Updating PHP
Code:
[root@sendmail round]# php -v
Code:
PHP 5.1.6 (cli) (built: Mar 14 2007 18:56:07) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
Code:
[root@sendmail ~]# cd /etc/yum.repos.d
Code:
[root@sendmail ~]# wget dev.centos.org/centos/5/CentOS-Testing.repo
Code:
[root@sendmail ~]# yum --disablerepo=* --enablerepo=c5-testing update php php-xml php-mysql
Code:
[root@sendmail round]# php -v
Code:
PHP 5.2.10 (cli) (built: Nov 13 2009 11:24:03) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
Code:
yum install mysql mysql-server /usr/bin/mysqladmin -u root password 'mysqlrootpassword'
Code:
[root@sendmail ~]# cd /tmp/ [root@sendmail ~]# wget nchc.dl.sourceforge.net/project/roundcubemail/roundcubemail/0.3.1/roundcube mail-0.3.1.tar.gz [root@sendmail ~]# tar -zxvf roundcubemail-0.3.1.tar.gz [root@sendmail ~]# mv roundcube /usr/share/ [root@sendmail ~]# vi /etc/httpd/conf/roundcube.conf
Code:
<IfModule mod_alias.c> Alias /rcm /usr/share/roundcube </IfModule> <Directory /usr/share/roundcube> Options None Order allow,deny
Code:
[root@sendmail ~]# vi /etc/httpd/conf/httpd.conf
Code:
Include /etc/httpd/conf/roundcube.conf
Code:
[root@sendmail ~]# chown -R root:apache /usr/share/roundcube/ [root@sendmail ~]# cd /usr/share/roundcube/ [root@sendmail ~]# chmod g+w temp/ [root@sendmail ~]# chmod g+w logs/
Code:
[root@sendmail ~]# mysql -u root -p
Code:
mysql> create database roundcube;
mysql> show databases; mysql> create user roundcube; mysql> GRANT ALL PRIVILEGES ON roundcube.* TO roundcube@localhost IDENTIFIED BY 'roundcube'; mysql> FLUSH PRIVILEGES; mysql> quit;
restart http
Code:
[root@sendmail ~]# /etc/init.d/httpd restart
In the browser,
Code:
yourserverip/rcm/installer/
Click the "START INSTALLATION" button These are all very simple forms in the browser. I cant enter all the options because the limited characters. Please contact me if there is any difficulties in filling those options. General configuration, Database setup, IMAP Settings, SMTP Settings Then click next The installer will generate two configuration files for you, Copy these contents (files) in side the /usr/share/roundcube/config
Code:
[root@sendmail ~]# vi main.inc.php [root@sendmail ~]# vi db.inc.php
Code:
[root@sendmail ~]# mv installer/ /tmp/