Configuring Qmail Server : Step by Step : Part-1

Configuring Qmail Server : Step by Step : Part-1

by -
0 5629

QMAIL Mail Server Configuration on CentOS/RHEL 6/5 step by step with details:

Here we tested on CentOS 5.4

About Qmail Server

Qmail is a secure, reliable, efficient, simple message transfer agent.
Qmail offers POP3, and IMAP (with the help of Courier-IMAP) so that you can use any mail client you prefer.
Qmail is Secure,reliable,efficient and Simple MTA
Qmail is Founded in June of 2003.
Qmail put together to provide a free and open resource for anyone needing help with the installation and configuration.
Qmail is an incredibly fast, stable and secure mail solution suitable for almost any environment.

Installation Steps:

Qmail itself ?  qmail, ucspi? tcp, daemontools w/enhanced logging.John Simpson’s massive qmail patch, which includes (among others)  qmailqueue, smtp?auth and TLS smtp encryption.
EZmlm ? A fast and easy to use mailing list manager that works through qmail.
Autoresponder ? Enables auto?responder capabilities on your qmail server.
 Vpopmail ? Enables virtual e?mail hosting for multiple domains. Available with or without mysql integration.
Vqadmin ? A web based interface to manage Vpopmail virtual domains on your qmail server.
Maildrop ? A server?wide mail filtering tool.
Qmailadmin ? A web based interface for managing vpopmail virtual email accounts.
Courier/imap/imap/ssl ? The popular IMAP/IMAP/SSL server.
Squirrelmail ? A web based mail client with a boat load of cool plugins available

Required Packages

Install  these  packages for trouble free installation >>

#yum -y install php
#yum -y install perl
#yum -y install gcc
#yum -y install mysql
#yum -y install openssl
#yum -y install wget
#yum -y install patch
#yum -y install patchutils

and need to remove sendmail,postfix and dovecot service

Download QmailRock Package

#mkdir /downloads
#cd /downloads
#wget http://www.qmailrocks.org/downloads/qmailrocks.tar.gz
#tar zxvf qmailrocks.tar.gz

Installation of Qmail Step by Step

Step 1:   Installing Qmail Itself

#sh /downloads/qmailrocks/scripts/install/qmr_install_linux-s1.script
#sh /downloads/qmailrocks/scripts/util/qmail_big_patches.script

#cd /usr/src/qmail/qmail-1.03

#make man && make setup check

# ./config-fast your_fqdn_hostname   <—Your Server’s hostname here

# make cert

Country Name (2 letter code) [GB]:IN
State or Province Name (full name) [Berkshire]:Delhi
Locality Name (eg, city) [Newbury]:bhikajicama
Organization Name (eg, company) [My Company Ltd]:kvit.in
Organizational Unit Name (eg, section) []:mailserver
Common Name (eg, your name or your server’s hostname) []:mail.kvit.in
Email Address []:vikas@kvit.in

Note: use your own details

#chown -R vpopmail:vchkpw /var/qmail/control/clientcert.pem /var/qmail/control/servercert.pem

#cd /usr/src/qmail/ucspi-tcp-0.88/
#patch < /downloads/qmailrocks/patches/ucspi-tcp-0.88.errno.patch
#make && make setup check
#cd /package/admin/daemontools-0.76
#cd /package/admin/daemontools-0.76/src
#patch < /downloads/qmailrocks/patches/daemontools-0.76.errno.patch
#cd /package/admin/daemontools-0.76
#package/install

Step2: EZmlm (Mailing list manager )

#cd /downloads/qmailrocks/
#tar zxvf ezmlm-0.53-idx-0.41.tar.gz
#cd ezmlm-0.53-idx-0.41
#make && make setup

Step3: AutoResponder

#cd /downloads/qmailrocks
#tar zxvf autorespond-2.0.5.tar.gz
#cd autorespond-2.0.5
#make && make install

Step 4 – Vpopmail  (without MySQL integration)

#cd /downloads/qmailrocks
#tar zxvf vpopmail-5.4.13.tar.gz
#cd vpopmail-5.4.13
#./configure –enable-logging=p
#make && make install-strip

Step 5 – Vqadmin ( Virtual Domain Creation by Web panel)

#cd /downloads/qmailrocks
#tar zxvf vqadmin-2.3.6.tar.gz
#cd vqadmin-2.3.6
#./configure –enable-cgibindir=/var/www/cgi-bin –enable-htmldir=/var/www/html
#make && make install-strip

Password protection for vqadmin panel >

#vi /etc/httpd/conf/httpd.conf

<Directory “/var/www/cgi-bin/vqadmin”>
deny from all
Options ExecCGI
AllowOverride AuthConfig
Order deny,allow
</Directory>

#cd /var/www/cgi-bin/vqadmin
#vi .htaccess

AuthType Basic
AuthUserFile /var/www/cgi-bin/vqadmin/.htpasswd
AuthName vQadmin
require valid-user
satisfy any
#chown apache .htaccess
#chmod 644 .htaccess

#htpasswd -bc /var/www/cgi-bin/vqadmin/.htpasswd admin india123

where:
username: admin
password:india123

#chmod 644 .htpasswd
#service httpd restart

NOW OPEN YOUR BROWSER AND CREATE A  DOMAIN

http://192.168.1.254/cgi-bin/vqadmin/vqadmin.cgi

Step 6:  Maildrop ( Mail Filtering Tool )

#cd /downloads/qmailrocks
#tar zxvf maildrop-1.6.3.tar.gz
#cd maildrop-1.6.3
#./configure –prefix=/usr/local –exec-prefix=/usr/local –enable-maildrop-uid=root –enable-maildrop-gid=vchkpw –enable-maildirquota

#make && make install-strip && make install-man

Step 7- Qmailadmin  ( Web based Control panel for managing email accounts )

#cd /downloads/qmailrocks
#tar zxvf qmailadmin-1.2.9.tar.gz
#cd qmailadmin-1.2.9
#./configure –enable-cgibindir=/var/www/cgi-bin –enable-htmldir=/var/www/html
#make && make install-strip

NOW OPEN YOUR BROWSER TO OPEN QMAIL ADMIN
http://192.168.1.254/cgi-bin/qmailadmin

qmail1after login

qmail2

 

Step 8 – Finalizing Qmail

# sh /downloads/qmailrocks/scripts/finalize/linux/finalize_linux.script

#vi /var/qmail/supervise/qmail-pop3d/run

Find “mail.example.com” and change it to your server’s hostname. For example: mail.mydomain.com.

#vi /var/qmail/supervise/qmail-smtpd/run

Find “mail.example.com” and change it to your server’s hostname. For example: mail.mydomain.com

#qmailctl stop
#echo ‘127.:allow,RELAYCLIENT=””‘ >> /etc/tcp.smtp
#qmailctl cdb

#echo postmaster@ > /var/qmail/alias/.qmail-root
#echo postmaster@ > /var/qmail/alias/.qmail-postmaster
#echo postmaster@ > /var/qmail/alias/.qmail-mailer-daemon

#ln -s /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-anonymous
#chmod 644 /var/qmail/alias/.qmail*

Step 9: Uninstall Sendmail/Postfix

#/etc/rc.d/init.d/sendmail stop
#rpm -e –nodeps sendmail-x.x.x.x
#rpm -e –nodeps sendmail-doc-x.x.x.x
#rpm -e –nodeps sendmail-devel-x.x.x.x
#rpm -e –nodeps sendmail-cf-x.x.x.x
#/etc/rc.d/init.d/sendmail stop
#mv /usr/lib/sendmail /usr/lib/sendmail.old
#mv /usr/sbin/sendmail /usr/sbin/sendmail.old
#chmod 0 /usr/lib/sendmail.old /usr/sbin/sendmail.old
#rpm -qa | grep postfix
#/etc/rc.d/init.d/postfix stop
#rpm -e nodeps postfix-x.x-x
#ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
#ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail

Step 10 :  Start Qmail Service

#qmailctl stop
#qmailctl start
#qmailctl stat

#telnet 192.168.1.254 110   <—-check pop3 service
Trying 192.168.1.254…
Connected to 192.168.1.254.
Escape character is ‘^]’.
+OK <16658.1054485137@yourserver.com>
user postmaster@mydomain.com (enter your username here. remember to use the full e-mail address)
—————————-
+OK
pass your_password
——————
+OK
quit
+OK
Connection closed by foreign host.

# telnet localhost 25     <—–check smtp

Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 somewhere.anywhere.com ESMTP
ehlo localhost
————–
250-somewhere.anywhere.com
250-AUTH LOGIN CRAM-MD5 PLAIN
250-AUTH=LOGIN CRAM-MD5 PLAIN
250-STARTTLS
250-PIPELINING
250 8BITMIME
starttls
——–
220 ready for tls
quit
quit
Connection closed by foreign host.

Configure Courier IMAP & IMAP SSL

#cd /downloads/qmailrocks/
#tar jxvf courier-authlib-0.55.tar.bz2
#cd courier-authlib-0.55

# ./configure –prefix=/usr/local –exec-prefix=/usr/local –with-authvchkpw –without-authldap –without-authmysql –disable-root-check –with-ssl –with-authchangepwdir=/usr/local/libexec/authlib –with-redhat

#make && make check
#make install-strip && make install-configure
#vi /etc/rc.local
#/usr/local/sbin/authdaemond start
#useradd bsmith
#cd /downloads/qmailrocks/
#tar jxvf courier-imap-4.0.2.tar.bz2
#chown -R bsmith:wheel courier-imap-4.0.2
#cd /downloads/qmailrocks/courier-imap-4.0.2
#su bsmith
#./configure –prefix=/usr/local –exec-prefix=/usr/local –with-authvchkpw –without-authldap –without-authmysql –disable-root-check –with-ssl –with-authchangepwdir=/usr/local/libexec/authlib –with-redhat

#make && make check
#make install-strip && make install-configure
———————————————————————–

#/usr/local/sbin/mkimapdcert
#vi /usr/local/etc/imapd.cnf
change postmaser@example.com an administrative email address
Save and exit
#vi /usr/local/etc/imapd
Make sure that the following configuration exists: IMAPDSTART=YES
#vi /usr/local/etc/imapd-ssl
Make sure that the following configuration exists: IMAPDSSLSTART=YES
Make sure that the following configuration exists: TLS_CERTFILE=/usr/local/share/imapd.pem
Save and exit the file.
#vi /usr/local/etc/authlib/authdaemonrc
Around like 27, you should see the “authmodulelist” setting. Make sure that “authvchkpw” is the only module listed. Like so:
authmodulelist=”authvchkpw”
Save and exit the file.
Now we create the startup scripts…

#cp /usr/local/libexec/imapd.rc /etc/rc.d/init.d/imap
#cp /usr/local/libexec/imapd-ssl.rc /etc/rc.d/init.d/imaps

Now let’s start up Authdaemond, IMAP and IMAPS. To be safe we’ll stop each service before starting it…
#/usr/local/sbin/authdaemond stop
#/usr/local/sbin/authdaemond start
#/etc/rc.d/init.d/imap stop
#/etc/rc.d/init.d/imaps stop
#/etc/rc.d/init.d/imap start
#/etc/rc.d/init.d/imaps start

If you run “nmap localhost”, you should see both 143 and 993 now open and listening.
Now let’s test it…

#nmap localhost

#telnet localhost 143

Installing Squirrelmail

#mkdir /var/sqattachements
#chown -R apache:apache /var/sqattachements
#cd /var/www/html/webmail
#chown -R apache:apache data
#cd config
#perl ./conf.pl

General
——-
1. Domain : 1.2.3.4 (Enter the IP of your server here. )
2. Invert Time : false
3. Sendmail or SMTP : SMTP
IMAP Settings
————–
4. IMAP Server : localhost
5. IMAP Port : 143
6. Authentication type : login
7. Secure IMAP (TLS) : false
8. Server software : other
9. Delimiter : detect
SMTP Settings
————-
4. SMTP Server : localhost
5. SMTP Port : 25
6. POP before SMTP : false
7. SMTP Authentication : login
8. Secure SMTP (TLS) : false

 

#vi /etc/httpd/conf/httpd.conf

<VirtualHost 192.168.1.254:80>
ServerName mail.mydomain.com
ServerAlias mail.*
ServerAdmin postmaster@mydomain.com
DocumentRoot /var/www/webmail
</VirtualHost>

#service httpd restart
http://192.168.1.254/webmail

CEO, KV IT-Solutions Pvt. Ltd. | vikas@kvit.in | 9810028374|
Linux Professional and an Industrial Trainer | 20 + years Experience in IT Industry

” We are born free, No Gate and Windows can snatch our freedom “

Download PDF

SIMILAR ARTICLES

0 1123

0 789

NO COMMENTS

Leave a Reply

Required Captcha *