QMAIL INSTALLATION :-
Packages needed for Qmail Installation
1. The Apache Web Server
2. PHP
3. Perl
4. GCC
5. OpenSSL
6. OpenSSL-devel
7. wget
8. patch & patchutils
Login to the server where you are going to install qmail and do the following settings.
# vi /etc/sysconfig/selinux and set
selinux=disabled
Part I – Downloading Qmail
#mkdir /downloads
#cd /downloads
Dowload the qmailrocks package from the following site,
#wget ftp://10.1.30.120/pub/qmailrocks.tar.gz
#tar zxvf qmailrocks.tar.gz
Part 2 - Installing Qmail Itself
This
shell script takes care of the first portion of getting qmail,
ucspi-tcp and daemontools intalled:
So
Run this script.
#/downloads/qmailrocks/scripts/install/qmr_install_linux-s1.script#/downloads/qmailrocks/scripts/util/qmail_big_patches.script
#cd /usr/src/qmail/qmail-1.03
#make man && make setup check
#./config-fast dev02.newindia.com(ex: ./config-fast mail.mydomain.com)
#make cert
make cert will ask some options, fill it up:
#chown -R vpopmail:qmail /var/qmail/control/clientcert.pem /var/qmail/control/servercert.pem
Installing ucspi-tcp-0.88:
#cd /usr/src/qmail/ucspi-tcp-0.88/
#patch < /downloads/qmailrocks/patches/ucspi-tcp-0.88.errno.patch
#make && make setup check
Installing Daemontools:
#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
Part 3 – Ezmlm
When we install
Qmailadmin later on, the EZmlm integrates seamlessly into Qmailadmin
to provide a very user friendly mailing list management interface:
#cd
/downloads/qmailrocks/#tar zxvf ezmlm-0.53-idx-0.41.tar.gz
#cd ezmlm-0.53-idx-0.41
#make && make setup
Part 4 – Autoresponder
It allows to set up
autoresponders for mailboxes and so forth:
#cd
/downloads/qmailrocks#tar zxvf autorespond-2.0.5.tar.gz
#cd autorespond-2.0.5
#make && make install
Part 5 – Vpopmail
Vpopmail is one of the
major components of this installation. Vpopmail allow to do virtual
domain mail hosting:
#cd
/downloads/qmailrocks#tar zxvf vpopmail-5.4.13.tar.gz
#cd vpopmail-5.4.13
#./configure --enable-logging=p
#make && make install-strip
Part 6 – Vqadmin
Vqadmin is simply a nice
web based interface that will used to manage Vpopmail. Through the
interface we can create new domains, new users, net quotas, enable
services and much more:
#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
Add the following to the server's Apache configuration file:
#vi /etc/httpd/conf/httpd.conf
<Directory "/var/www/cgi-bin/vqadmin">
deny from all
Options ExecCGI
AllowOverride AuthConfig
Order deny,allow
</Directory>
Create
a .htaccess file to password protect the Vqadmin interface at the
vqadmin directory and configure the following:
#cd
/var/www/cgi-bin/vqadmin/#vi .htacess
AuthType Basic
AuthUserFile /var/www/cgi-bin/vqadmin/.htpasswd
AuthName vQadmin
quire valid-user
stisfy any
#chown apache .htaccess
#chmod 644 .htaccess
Create a corresponding .htpasswd file that's going to contain the username and encrypted password for the Vqadmin administrator...
#htpasswd -bc /var/www/cgi-bin/vqadmin/.htpasswd admin qmailctl(password)
#chmod 644 /var/www/cgi-bin/vqadmin/.htpasswd
Now restart Apache...
#apachectl stop
#apachectl start
Access vqadmin in this following page,
http://10.1.30.103/cgi-bin/vqadmin/vqadmin.cgi
username /password – As given above to .htpasswd
Part 7- Maildrop
Maildrop is a mail
filtering agent which can be used to filter messages as they arrive
on the server:
#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
Part 8 – Qmailadmin
Qmailadmin provides nice web based interface for administering mail accounts once they are setup through Vpopmail (or Vqadmin). From Qmailadmin we can create mailboxes, aliases, fowards, mail robots, mailing lists:
#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
Open the browser, http://10.1.30.103/cgi-bin/qmailadmin and login as ,
user – postmaster
domain – newindia.com
password – as given to .htpasswd
Part 9 - Finalizing Qmail
Run the script, after
that change the files to following:
#/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: linux0103.dev02.newindia.com
# /var/qmail/supervise/qmail-smtpd/run
Find "mail.example.com" and change it to your server's hostname
Stop the Qmail process..
#qmailctl stop
Setting up selective relaying for localhost...
#echo '127.:allow,RELAYCLIENT=""' >> /etc/tcp.smtp
#qmailctl cdb
Create the common system aliases. These aliases are going to tell Qmail what to do with common server-generated mails.
#echo sysadmin-india > /var/qmail/alias/.qmail-root
#echo sysadmin-india > /var/qmail/alias/.qmail-postmaster
#echo sysadmin-india > /var/qmail/alias/.qmail-mailer-daemon
#ln -s /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-anonymous
#chmod 644 /var/qmail/alias/.qmail*
Part 10 - Uninstalling Sendmail
Removing Sendmail:
#/etc/rc.d/init.d/sendmail
stop (to stop Sendmail)#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
Establishing an
"artificial" Sendmail path:
#ln
-s /var/qmail/bin/sendmail /usr/lib/sendmail#ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
Part 11 - Starting qmail
Run this script that will
check the key components of the installation and make sure everything
is alright. If its not right it will show the options to check:
#/downloads/qmailrocks/scripts/util/qmr_inst_checkIf the result is "congratulations" type of message, everything is fine
Restart the Qmail services.
#qmailctl stop
#qmailctl start
#qmailctl stat
/service/qmail-send: up (pid 29956) 2 seconds
/service/qmail-send/log: up (pid 29960) 2 seconds
/service/qmail-smtpd: up (pid 29963) 2 seconds
/service/qmail-smtpd/log: up (pid 29968) 2 seconds
/service/qmail-pop3d: up (pid 29971) 2 seconds
/service/qmail-pop3d/log: up (pid 29972) 2 seconds
messages in queue: 0
messages in queue but not yet preprocessed: 0
Checking the connections:
#telnet localhost 110
Trying 10.1.30.103...
Connected to 10.1.30.103.
Escape character is '^]'.
+OK <16658.1054485137@yourserver.com>
user postmaster@newindia.com
+OK
pass <password>
+OK
quit
+OK
Connection closed by foreign host.
#telnet localhost 110
Trying 10.1.30.103...
Connected to 10.1.30.103.
Escape character is '^]'.
+OK <16658.1054485137@yourserver.comt>
user postmaster@newindia.com
+OK
pass <password>
+OK
list
+OK
1 323 (there's your message!)
quit
+OK
Connection closed by foreign host.
And now let's test SMTP service to make sure the TLS functionaltiy is there...
#telnet localhost 25
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.
#chown vpopmail:qmail /var/qmail/control/servercert.pem
Part 12 - Installing 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
Adding
services to start automatically when the system starts up.
#vi
/etc/rc.local
Add the
following line:#/usr/local/sbin/authdaemond start
INSTALLING
COURIER-IMAP:
#cd
/downloads/qmailrocks/
#tar
jxvf courier-imap-4.0.2.tar.bz2#useradd courier
#chown -R courier:wheel courier-imap-4.0.2
#cd /downloads/qmailrocks/courier-imap-4.0.2
#su courier
#./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
Note: the configure process will take a few minutes..
#make && make check
#exit
#make
install-strip && make install-configure
Now
let's create an SSL certificate for the IMAP-SSL server...#/usr/local/sbin/mkimapdcert
#vi
/usr/local/etc/imapd.cnf
change
postmaser@example.com an administrative email addressSave and exit
Changing the setting for imap
#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.
Changing
the options for authdaemonrc
#vi
/usr/local/etc/authlib/authdaemonrc
Find
authmodulelist and delete other than the folowing,
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 start 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
Run "nmap localhost", to see both 143 and 993 is now open and listening.
Now test imap connection....
#telnet localhost 143
Trying 10.1.30.103...
Connected to 10.1.30.103.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE STARTTLS] Courier-IMAP ready. Copyright 1998-2003 Double Precision, Inc. See COPYING for distribution information.
a login postmaster@mydomain.com my_password
a OK LOGIN Ok. (successful login!)
a logout (logs you out)
* BYE Courier-IMAP server shutting down
a OK LOGOUT completed
Connection closed by foreign host.
Part
13 - Installing Squirrelmail
Download
the squirrelmail version and copy it to /var/www/html
#tar
zxvf /path/to/squirrelmail-x.x.x.tar.gz
Now
rename the untarred folder
#mv
squirrelmail-x.x.x webmailConfiguring Squirrelmail...
#mkdir /var/sqattachements
#chown -R apache:apache /var/sqattachements (or whatever user apache runs as)
#cd webmail
#chown -R apache:apache data (or whatever user apache runs as)
#cd config
#./conf.pl
For our Setup we can download webmail on following:
link: ftp://10.1.30.120/pub/webmail.tar.gz
We need to change “ data “ folder to
#chown apache.apache data/ -R
This will run the Squirrelmail setup script which will allow to customize the installation as well as server settings.
General
-----------
1. Domain : newindia.com
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 (with IMAP username and password)
8. Secure SMTP (TLS) : false
9. Header encryption key :
There
are probably about a million ways to do this, but here's what I do. I
edit the httpd.conf Apache configuration file and add the following
block:
<VirtualHost
10.1.30.103:80>ServerName linux0103.dev02.newindia.com
ServerAlias mail.*
ServerAdmin sysadmin-india@newindia.com
DocumentRoot /var/www/html/webmail
</VirtualHost>
To
open the link, follow this,
Part
13 - Installing Fastforward
Download
Fastforward to /var/qmail and install it.
To
install fastforward follow these steps,
#cd
/var/qmail
#tar
-zxvf fastforward-x.xx.tar.gz
#cd
fastforward-x.xx
#vi
error.h
Remove
the line extern int errno; and insert #include<errno.h> and
save it.
#make
setup check
or
#vi
error.h
Only
to add into file conf-cc.
-include /usr/include errno.h
Like follows.
cc -O2 -include /usr/include/errno.h
-include /usr/include errno.h
Like follows.
cc -O2 -include /usr/include/errno.h
ALIASES:
#vi
/etc/aliases
Update
the aliases in this file and run,
#/var/qmail/fastforward-x.xx/newaliases