You are on page 1of 9

1.

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

Verify the installation and compilation options

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 ========================================================

This command will show the compiled options of sendmail.

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

Edit the mc file

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"

Add a user and set password

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:
senthil@example.com senthil

Configure Dovecot

Code:
[root@sendmail mail]# vi /etc/dovecot.conf

Code:
protocols = imap pop3

create the sendmail cf file with mc file

Code:
[root@sendmail mail]# m4 sendmail.mc > sendmail.cf [root@sendmail mail]# make

Start the services

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

Make required services permanent (after a reboot they start automatically)

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

Install Mysql And set root password

Code:
yum install mysql mysql-server /usr/bin/mysqladmin -u root password 'mysqlrootpassword'

Download Round cube Stable version and extract it

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

Inside this file add as follows,

Code:
<IfModule mod_alias.c> Alias /rcm /usr/share/roundcube </IfModule> <Directory /usr/share/roundcube> Options None Order allow,deny

allow from all </Directory>

Code:
[root@sendmail ~]# vi /etc/httpd/conf/httpd.conf

add the following line,

Code:
Include /etc/httpd/conf/roundcube.conf

Set Some permissions

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/

Create Database for Round cube in Mysql

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

The installer directory should be moved to some other path.

Code:
[root@sendmail ~]# mv installer/ /tmp/

Finished in browser, yourip/rcm will work like charm