Qmail on Ubuntu ServerEdition 9.10 (64-bit Edition)
01. Put IP and dns and make sure server is connected to internet ....
02. apt-get update
03. apt-get upgrade
04. apt-get -q -y install build-essential libssl-dev libssl-dev openssl csh expectk zip libgdbm-dev libmysqlclient16-dev unzip libpcre3 libpcre3-dbg libpcre3-de
v libpcrecpp0 rcconf vim-nox iftop xinetd perl-suid libtool libltdl7 libltdl7-dev libguile-ltdl-1
05. Download my Qmail Packages tarball and do as follows;
tc: mkdir /downloads
tc: cd /opt/
tc: wget http://www.linux-bd.com/app/qmail-rkarim-ubuntu910.tar.gz
tc: tar zxvf qmail-rkarim-ubuntu910.tar.gz
tc: cp /opt/qmail-install/qmailrocks.tar.gz /downloads/
tc: cd /opt/qmail-install/
07- Unpacking qmail-1.03.tar.gz, ucspi-tcp-0.88.tar.gz and daemontools-0.76.tar.gz
tc: mkdir -p /var/qmail
tc: mkdir -p /usr/src/qmail
tc: cd /opt/qmail-install
tc: cp qmail-1.03.tar.gz ucspi-tcp-0.88.tar.gz /usr/src/qmail
tc: mkdir -p /package
tc: cp daemontools-0.76.tar.gz /package
tc: chmod 1755 /package
tc: cd /usr/src/qmail
tc: tar zxvf qmail-1.03.tar.gz
tc: tar zxvf ucspi-tcp-0.88.tar.gz
tc: cd /package
tc: tar zxvf daemontools-0.76.tar.gz
tc: cp /opt/qmail-install/quser.sh /package/
tc: chmod 755 quser.sh
tc: ./quser.sh
09- Creating logging directories
tc: mkdir /var/log/qmail
tc: cd /var/log/qmail
tc: mkdir qmail-send qmail-smtpd qmail-pop3d
tc: chown -R qmaill:root /var/log/qmail
tc: chmod -R 750 /var/log/qmail
tc: mkdir /var/qmail/supervise
tc: cd /var/qmail/supervise
tc: mkdir -p qmail-smtpd/log qmail-send/log qmail-pop3d/log
tc: chmod +t qmail-smtpd qmail-send qmail-pop3d
10- Build and Install qmail-1.03
tc: cd /usr/src/qmail/qmail-1.03
tc: patch < /opt/qmail-install/qmail-patches/qmail-1.03-jms1.7.08.patch
tc: echo 211 > /usr/src/qmail/qmail-1.03/conf-split
tc: echo 255 > /usr/src/qmail/qmail-1.03/conf-spawn
tc: make man && make setup check
tc: echo 255 > /var/qmail/control/concurrencyremote
tc: chmod 644 /var/qmail/control/concurrencyremote
tc: echo 1 > /var/qmail/control/mfcheck
tc: ./config-fast mx.linux-bd.com
11- Now Install ucspi-tcp
tc: cd /opt/qmail-install
tc: cd /usr/src/qmail/ucspi-tcp-0.88
tc: patch < /opt/qmail-install/qmail-patches/ucspi-tcp-0.88.errno.patch
tc: make
tc: make setup check
12- Now Install daemontools
tc: cd /package/admin/daemontools-0.76
tc: cd src
tc: patch < /opt/qmail-install/qmail-patches/daemontools-0.76.errno.patch
tc: cd ..
tc: package/install
3- Fixing the SVC Service of daemontools to work-with Ubuntu Server Editon 9.10
tc: vim /etc/init/svscan.conf # add following lines ..
# svscan - daemontools
start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5
stop on runlevel 0
stop on runlevel 1
stop on runlevel 6
respawn
exec /command/svscanboot
Save+Exit
tc: vim /etc/rc.local # add folloiwng line befor exit 0
initctl start svscan
save+exit
# So now make sure following active lines exits in /etc/rc.local file (delete any other active lines)
initctl start svscan
exit 0
tc: initctl start svscan
tc: chmod 755 /etc/rc.local
#Now run ps -aux as follows to see that svscan service is up and running
tc: ps -aux |grep svscan
# you should see the following output
--------------------------------------------------------------------------------------------------------------
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
root 4140 0.0 0.0 1844 504 ? Ss 08:21 0:00 /bin/sh /command/svscanboot
root 4184 0.0 0.0 1796 376 ? S 08:21 0:00 svscan /service
root 12446 0.0 0.0 3240 800 pts/0 S+ 13:53 0:00 grep svscan
---------------------------------------------------------------------------------------------------------------
14- Get ready and Start your Qmail Service/Server (I used some qmailrocks script to minimize complexity)
tc: cd /downloads ; tar zxvf qmailrocks.tar.gz
tc: /downloads/qmailrocks/scripts/finalize/linux/finalize_linux.script
tc: rm -fr /var/qmail/supervise/qmail-pop3d/run [ remove the default file ]
tc: cp /opt/qmail-install/run_pop3d /var/qmail/supervise/qmail-pop3d/run [ Copy/Past my file; and replace "mx.linux-bd.com" with your own FQDN]
tc: vim /var/qmail/supervise/qmail-pop3d/run
default /var/qmail/supervise/qmail-pop3d/run file ...
--------------------------------------------------------------------------- # skip/cut this dashed line then copy/past
#!/bin/sh
PATH=/var/qmail/bin:/usr/local/bin:/usr/bin:/bin
export PATH
exec tcpserver -H -R -l -v -c100 0 110 qmail-popup mail.example.com \
/home/vpopmail/bin/vchkpw qmail-pop3d Maildir 2>&1
--------------------------------------------------------------------------- # skip/cut this dashed line then copy/past
Save+Exit
tc: rm -fr /var/qmail/supervise/qmail-smtpd/run [ remove the default file ]
tc: cp /opt/qmail-install/run_smtpd /var/qmail/supervise/qmail-smtpd/run [ Copy/Past my file; and replace "mx.linux-bd.com" with your own FQDN]
tc: vim /var/qmail/supervise/qmail-smtpd/run
default /var/qmail/supervise/qmail-pop3d/run file ...
--------------------------------------------------------------------------- # skip/cut this dashed line then copy/past
#!/bin/sh
#QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl"; export QMAILQUEUE
QMAILDUID=`id -u vpopmail`
NOFILESGID=`id -g vpopmail`
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
LOCAL=`head -1 /var/qmail/control/me`
if [ -z "$QMAILDUID" -o -z "$NOFILESGID" -o -z "$MAXSMTPD" -o -z "$LOCAL" ]; then
echo QMAILDUID, NOFILESGID, MAXSMTPD, or LOCAL is unset in
echo /var/qmail/supervise/qmail-smtpd/run
exit 1
fi
if [ ! -f /var/qmail/control/rcpthosts ]; then
echo "No /var/qmail/control/rcpthosts!"
echo "Refusing to start SMTP listener because it'll create an open relay"
exit 1
fi
exec /usr/local/bin/softlimit -m 120000000 \
/usr/local/bin/tcpserver -v -R -H -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \
-u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \
/usr/local/bin/rblsmtpd -b -r bl.spamcop.net -r zen.spamhaus.org -r dnsbl.sorbs.net \
/var/qmail/bin/qmail-smtpd mail.example.com \
/var/qmail/bin/qmail-smtpd 2>&1
--------------------------------------------------------------------------- # skip/cut this dashed line then copy/past
Save+Exit
tc: qmailctl stop
# here you can also enter your network/lan subnet those you want to allow to use your server as smtp-server
tc: echo '127.:allow,RELAYCLIENT=""' >> /etc/tcp.smtp
tc: echo '123.49.42.180:allow,RELAYCLIENT=""' >> /etc/tcp.smtp
tc: echo '192.168.:allow,RELAYCLIENT=""' >> /etc/tcp.smtp
tc: qmailctl cdb
# change the domain name as your own ...
tc: echo postmaster@linux-bd.com > /var/qmail/alias/.qmail-root
tc: echo postmaster@linux-bd.com > /var/qmail/alias/.qmail-postmaster
tc: echo postmaster@linux-bd.com > /var/qmail/alias/.qmail-mailer-daemon
tc: ln -s /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-anonymous
tc: ln -s /var/qmail/alias/.qmail-postmaster /var/qmail/alias/.qmail-abuse
tc: chmod 644 /var/qmail/alias/.qmail*
tc: qmailctl start
15- Make Symbolic Link_for Sendmail
tc: rm -fr /usr/lib/sendmail # if file already exits
tc: rm -fr /usr/sbin/sendmail # if file already exits
tc: ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
tc: ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
# It is now better to reboot your server but it is optional; you can avoid reboot....
reboot
16- Install vpopmail with mysql integration
# Create vpopmail database, user and password ....
tc: mysql -u root -p # login with your mysql root password
# Output will be as follows .....
-----------------------------------------------------------------------------------------------------------------------------------------
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 117
Server version: 5.1.37-1ubuntu5 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
-----------------------------------------------------------------------------------------------------------------------------------------
# apply the following command on mysql console ...put your own password in place of "the_strong_password"
mysql>
mysql > create database vpopmail;
mysql > grant update, create, delete, insert, select on vpopmail.* to vpopmailuser@localhost identified by "the_strong_password";
mysql > flush privileges;
mysql> exit;
tc: mkdir -p /home/vpopmail/etc
tc: chown vpopmail:vchkpw /home/vpopmail/etc
tc: echo "localhost|0|vpopmailuser|the_strong_password|vpopmail" > /home/vpopmail/etc/vpopmail.mysql
tc: chown vpopmail:vchkpw /home/vpopmail/etc/vpopmail.mysql
tc: chmod 640 /home/vpopmail/etc/vpopmail.mysql
# Check that your vpopmail pasword is working properly ....
tc: mysql -u vpopmailuser -p # try to login with "the_strong_password" and must be successfull...
# Output will be as follows .....
-------------------------------------------------------------------------------------------------
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 118
Server version: 5.1.37-1ubuntu5 (Ubuntu)
Type 'help;' or '\h' fors help. Type '\c' to clear the current input statement.
mysql> exit;
Bye
-------------------------------------------------------------------------------------------------
# So, you are ready to install vpopmail itself now .....
tc: cd /opt/qmail-install
tc: tar zxvf vpopmail-5.4.29.tar.gz
tc: cd vpopmail-5.4.29
tc: vim vconfig.sh
----------------------------------------------------------------------------------------------------------------------
./configure --enable-roaming-users=y --enable-logging=y --enable-ip-alias-domains=y \
--enable-auth-module=mysql --enable-clear-passwd=n --enable-libdir=/usr/lib/mysql/ \
--enable-tcpserver-path=/etc/ --enable-tcpserver-file=/etc/tcp.smtp --enable-qmail-ext \
--enable-logging=e --enable-tcprules-prog=/usr/local/bin/tcprules --enable-rebuild-tcpserver-file
----------------------------------------------------------------------------------------------------------------------
SAVE+ EXIT
tc: chmod 755 vconfig.sh
tc: ./vconfig.sh
tc: make && make install-strip
# Set the crontab to refresh your mysql connction session of users ....
tc: vim /etc/crontab
----------------------------------------------------------------------------------
40 * * * * root /home/vpopmail/bin/clearopensmtp 2>&1 > /dev/null
----------------------------------------------------------------------------------
SAVE+EXIT
# apply command ...
tc: /home/vpopmail/bin/clearopensmtp
17- Ezlm, Autoresponder, Maildrop
# Ezlm
tc: cd /downloads/qmailrocks/ ; tar zxvf ezmlm-0.53-idx-0.41.tar.gz ; cd ezmlm-0.53-idx-0.41 ; make && make setup
# Autoresponder
tc: cd /downloads/qmailrocks/ ; tar zxvf autorespond-2.0.5.tar.gz ; cd autorespond-2.0.5 ; make && make install
# Maildrop
tc: cd /opt/qmail-install ; tar jxvf maildrop-2.2.0.tar.bz2 ; cd maildrop-2.2.0
tc: ./configure --prefix=/usr/local --exec-prefix=/usr/local --enable-maildrop-uid=root --enable-maildrop-gid=vchkpw --enable-maildirquota
tc: make && make install-strip && make install-man
18- Install Vqadmin fors GUI/Web-based fors Mastering your total qmail server ...
tc: mkdir -p /var/www/html/images
tc: cd /opt/qmail-install
tc: tar zxvf vqadmin-2.3.7.tar.gz
tc: cd vqadmin-2.3.7
tc: cp /opt/qmail-install/vpopmail-5.4.29/config.guess /opt/qmail-install/vqadmin-2.3.7/ # for 64bit linux only ; skip this line if 32bit linux
tc: cp /opt/qmail-install/vpopmail-5.4.29/config.sub /opt/qmail-install/vqadmin-2.3.7/ # for 64bit linux only ; skip this line if 32bit linux
tc: libtoolize --force && ./configure --enable-cgibindir=/usr/lib/cgi-bin --enable-htmldir=/var/www/html # for 64bit linux only ; skip this line if 32bit linux
tc: ./configure --enable-cgibindir=/usr/lib/cgi-bin --enable-htmldir=/var/www/html # for 32bit linux only
tc: make && make install-strip
tc: cd /usr/lib/cgi-bin/vqadmin/
tc: vim .htaccess
-----------------------------------------------------------
AuthType Basic
AuthUserFile /etc/apache2/vqadmin.passwd
AuthName vQadmin
require valid-user
satisfy any
-----------------------------------------------------------
SAVE+EXIT
tc: chown www-data .htaccess
tc: chmod 644 .htaccess
tc: vim /etc/apache2/apache2.conf
-------------------------------------------------------------------------------------------------------
# Put the follwing after ServerRoot Line as follows ...
ServerRoot "/etc/apache2" # find this line
ServerName "mx" # add this line after the live above
# and .... add the following lines at the end of the apache2.conf file (last end) ....
<Directory "/usr/lib/cgi-bin/vqadmin">
deny from all
Options ExecCGI
AllowOverride AuthConfig
Order deny,allow
</Directory>
-------------------------------------------------------------------------------------------------------
Save+Exit
# Create the password for web GUI login of VQADMIN PANNEL ....
tc: htpasswd -c /etc/apache2/vqadmin.passwd admin
----------------------------------------------------------------
# Output should be as follows ...
New password: "the_strong_password"
Re-type new password: "the_strong_password"
Adding password fors user admin
----------------------------------------------------------------
tc: chown www-data /etc/apache2/vqadmin.passwd
tc: chmod 644 /etc/apache2/vqadmin.passwd
tc: /etc/init.d/apache2 restart
tc: mkdir /var/www/images
tc: cp -r /var/www/html/images/* /var/www/images/
NOW .... # you can use IP address <123.49.42.180> instead of mx.linux-bd.com to access web GUI
... ... open url http://mx.linux-bd.com/cgi-bin/vqadmin/vqadmin.cgi or
... ... open url http://123.49.42.180/cgi-bin/vqadmin/vqadmin.cgi
... ... and add domain "linux-bd.com" and set the "postmaster" password that will require to loging via QmailAdmin
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
vqadmin ...err (64bit linux)
http://www.opensubscriber.com/message/vqadmin@inter7.com/11452196.html
http://www.noah.org/wiki/Qmail_64-bit
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Now make a check that your vpopmial is working properly as ...
tc: telnet localhost 110
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK <6700.1260357304@mail.linux-bd.com>
user postmaster@linux-bd.com
+OK
pass your_postmaster_password
+OK
quit
+OK
Connection closed by foreign host.
...
rest (from step-19) of the qmial-howto is unchaged as http://www.linux-bd.com/qmail/qmail-install.html; except step-23 as now clamav-95.3 is available instead o
f clamav-95.1
...
STEP: 19- Install Qmail Admin the nice Qmail Domain Users/Email IDs Administration GUI Pannel
tc: cd /opt/qmail-install
tc: tar zxvf qmailadmin-1.2.13.tar.gz
tc: cd qmailadmin-1.2.13
tc: vim qmconfig.sh
---------------------------------------------------------------------------------------------------------------------------------------------
./configure --enable-htmldir=/var/www/html --enable-imagedir=/var/www/images --enable-imageurl=/images \
--enable-cgibindir=/usr/lib/cgi-bin/ --enable-autoresponder-bin=/usr/local/bin --enable-vpopuser=vpopmail \
--enable-ezmlmdir=/usr/local/bin/ezmlm/ --enable-ezmlmidx=y --enable-modify-quota --disable-ipauth --enable-help
---------------------------------------------------------------------------------------------------------------------------------------------
tc: chmod 755 qmconfig.sh
tc: ./qmconfig.sh
tc: make && make install-strip
tc: cd /etc/apache2/sites-available/
tc: vim mailadmin.linux-bd.com
----------------------------------------------------------------
<VirtualHost *:80>
ServerAdmin postmaster@linux-bd.com
ServerName mailadmin.linux-bd.com
DocumentRoot /var/www/
<Directory /var/www/>
AllowOverride AuthConfig Limit
Options SymLinksIfOwnerMatch Includes
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
ScriptAlias /global-cgi/ /usr/lib/cgi-bin/
</VirtualHost>
----------------------------------------------------------------
SAVE+EXIT
tc: ln -s /etc/apache2/sites-available/mailadmin.linux-bd.com /etc/apache2/sites-enabled/
tc: /etc/init.d/apache2 restart
# NOW ...# you can use IP address <123.49.42.180> instead of mxadmin.linux-bd.com to access web GUI
... open url "http://mailadmin.linux-bd.com/cgi-bin/qmailadmin" or
... open url "http://123.49.42.180/cgi-bin/qmailadmin"
login with "postmaster" password and domain name "linux-bd.com"
and add several email ids as you want ...
+++
STEP: 20- Courier IMAP 4.x (One of critical qmial-imap service)
tc: cd /opt/qmail-install
tc: tar jxvf courier-authlib-0.60.2.tar.bz2
tc: cd courier-authlib-0.60.2
tc: ./configure --prefix=/usr/local --exec-prefix=/usr/local --with-authvchkpw --without-authldap --without-authmysql --disable-root-check --with-ssl --with-aut
hchangepwdir=/usr/local/libexec/authlib
tc: make && make check
tc: make install-strip && make install-configure
tc: vim /etc/rc.local
----------------------------------------------------------------
/usr/local/sbin/authdaemond start
----------------------------------------------------------------
SAVE+EXIT
# Now apply command ...
tc: /usr/local/sbin/authdaemond start
tc: useradd rkarim # a add system user cause courier-imap should install as non-root user ...
tc: cd /opt/qmail-install
tc: tar jxvf courier-imap-4.3.0.tar.bz2
tc: chown -R rkarim courier-imap-4.3.0
tc: cd courier-imap-4.3.0
tc: su rkarim
tc: ./configure --prefix=/usr/local --exec-prefix=/usr/local --with-authvchkpw --without-authldap --without-authmysql --disable-root-check --with-ssl --with-aut
hchangepwdir=/usr/local/libexec/authlib
tc: make && make check
tc: exit
tc: make install-strip && make install-configure
tc: /usr/local/sbin/mkimapdcert
tc: vim /usr/local/etc/imapd.cnf
----------------------------------------------------------------------------------------------------------------------------------
... change "postmaser@example.com" with "postmaster@linux-bd.com" as an administrative email address
----------------------------------------------------------------------------------------------------------------------------------
SAVE+EXIT
tc: vim /usr/local/etc/imapd # SET the following
----------------------------------------------------------------
IMAPDSTART=YES
----------------------------------------------------------------
SAVE+EXIT
tc: vim /usr/local/etc/imapd-ssl # SET the following
----------------------------------------------------------------
IMAPDSSLSTART=YES
TLS_CERTFILE=/usr/local/share/imapd.pem
----------------------------------------------------------------
SAVE+EXIT
tc: vim /usr/local/etc/authlib/authdaemonrc
-----------------------------------------
authmodulelist="authvchkpw"
-----------------------------------------
tc: cp /usr/local/libexec/imapd.rc /etc/init.d/imap
tc: cp /usr/local/libexec/imapd-ssl.rc /etc/init.d/imaps
tc: /usr/local/sbin/authdaemond stop ; /usr/local/sbin/authdaemond start
tc: /etc/init.d/imap stop ; /etc/init.d/imaps stop
tc: /etc/init.d/imap start ; /etc/init.d/imaps start
tc: vim /etc/rc.local # add the following two line ...
-----------------------------------------------------------------
/etc/init.d/imap start
/etc/init.d/imaps start
# also disable the following line ...in /etc/rc.local
csh -cf '/command/svscanboot &'
-----------------------------------------------------------------
SAVE+EXIT
tc: chmod 755 /etc/rc.local
# Veryfy your IMAP-SERVICE that it is running properly ...
tc: telnet localhost 143 # login must be successfull for imap
--------------------------------------------------------------------------------------------------------------------------
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 ...i cut here... distribution information
a login postmaster@linux-bd.com your_postmaster_password
a OK LOGIN Ok. (successful login!)
a logout
* BYE Courier-IMAP server shutting down
a OK LOGOUT completed
Connection closed by foreign host...
-------------------------------------------------------------------------------------------------------------------------
If all above everything goes fine ... you are ready to install webmail-client now...
++
STEP: 21- ROUNDCUBE-WEBMAIL CLIENT (AJAX BASED WEBMAIL CLIENT)
# Reference-1: http://wiki.qnap.com/wiki/RoundCube_Configuration
# Reference-2: http://www.howtoforge.com/roundcube_webmail_ispconfig
tc: apt-get -q -y install roundcube # and follow the onscreen steps just to meet the dependency and don't configure MYSQL-DB as appear u common-db config
#... you can download the latest roundcubemail from internet "http://roundcube.net/"
tc: cd /opt/qmail-install
tc: cp roundcubemail-0.3.1.tar.gz /var/www/
tc: cd /var/www
tc: tar zxvf roundcubemail-0.3.1.tar.gz
tc: mv roundcubemail-0.3.1 webmail
tc: cd webmail
tc: chown -R www-data:www-data temp
tc: chown -R www-data:www-data logs
tc: rm -fr installer
tc: cd SQL
tc: mysql -u root -p # login to mysql as root
----------------------------------------------------------------------------------------
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 126
Server version: 5.1.37-1ubuntu5 (Ubuntu)
Type 'help;' or '\h' fors help. Type '\c' to clear the current input statement.
mysql>
-----------------------------------------------------------------------------------------
mysql>
mysql> CREATE DATABASE roundcubemail;
mysql> CREATE USER 'rc_user'@'localhost' IDENTIFIED BY 'pw_rc_user';
mysql> GRANT ALL PRIVILEGES ON roundcubemail.* TO rc_user@localhost IDENTIFIED BY 'pw_rc_user'; # (put your own user/password)
mysql> use roundcubemail; source /var/www/webmail/SQL/mysql.initial.sql;
mysql> FLUSH PRIVILEGES;
mysql> exit;
tc: cd /var/www/webmail/config/
tc: cp db.inc.php.dist db.inc.php
tc: cp main.inc.php.dist main.inc.php
tc: vim db.inc.php
----------------------------------------------------------------------------------------------------
# configure the following line as your need ...
$rcmail_config['db_dsnw'] = 'mysql://rc_user:pw_rc_user@localhost/roundcubemail';
----------------------------------------------------------------------------------------------------
SAVE+EXIT
tc: vim main.inc.php
----------------------------------------------------------------------------------------------------
# configure the following lines as your need ...
$rcmail_config['default_host'] = 'localhost';
$rcmail_config['username_domain'] = 'linux-bd.com';
$rcmail_config['mail_domain'] = 'linux-bd.com';
$rcmail_config['smtp_server'] = 'localhost';
$rcmail_config['product_name'] = 'LINUXBD WEBMAIL';
$rcmail_config['create_default_folders'] = TRUE;
$rcmail_config['htmleditor'] = TRUE;
-----------------------------------------------------------------------------------------------------
SAVE+EXIT
# Configure Virtual hosting...
tc: cd /etc/apache2/sites-available/
tc: vim mail.linux-bd.com
----------------------------------------------------------------
<VirtualHost *:80>
ServerAdmin postmaster@linux-bd.com
ServerName mail.linux-bd.com
DocumentRoot /var/www/webmail
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
# Again set the location you want to serve sites from
<Directory /var/www/webmail>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
----------------------------------------------------------------
SAVE+EXIT
tc: ln -s /etc/apache2/sites-available/mail.linux-bd.com /etc/apache2/sites-enabled/
tc: vim /etc/php5/apache2/php.ini # and set the following values ...
memory_limit = 128M
post_max_size = 32M
upload_max_filesize = 12M # your webmail attachment size ...
Save + Exit
tc: cp /etc/php5/apache2/php.ini /etc/php5/cli/php.ini
tc: /etc/init.d/apache2 restart
# NOW ...# you can use IP address <123.49.42.180> instead of mxadmin.linux-bd.com to access web GUI
..... open url "http://mail.linux-bd.com/" or
..... open url "http://123.49.42.180/webmail"
..... login with "email-id" and "password"
..... Enjoy roundcuebe webmail.
+++
STEP: 22- Install SpamAssassin
# run ....
tc: apt-get -q -y install spamassassin spamc
# now run rcconf and de-select "SpamAssassin"
tc: rcconf
tc: vim /etc/rc.local # and add the following line
----------------------------
/usr/sbin/spamd -d
----------------------------
SAVE+EXIT
tc: groupadd spamd
tc: useradd -g spamd -s /bin/false spamd
tc: cd /etc/mail/spamassassin/
tc: cp local.cf local.cf.ori
tc: echo " " > local.cf
tc: vim local.cf
# add the following lines (you can copy/past)...
----------------------------------------------------------------
required_hits 5.0
add_header all Report _REPORT_
rewrite_header Subject 1
add_header spam Flag _YESNOCAPS_
add_header all Status _YESNO_, score=_SCORE_ required=_REQD_ tests=_TESTS_ autolearn=_AUTOLEARN_ version=_VERSION_
add_header all Level _STARS(*)_
add_header all Checker-Version SpamAssassin _VERSION_ (_SUBVERSION_) on _HOSTNAME_
dns_available yes
skip_rbl_checks 0
----------------------------------------------------------------
SAVE+EXIT
tc: vim /etc/default/spamassassin
# ensure following lines exists and change if require
----------------------------------------------------------------
ENABLED=1
OPTIONS="--create-prefs --max-children 5 --helper-home-dir"
PIDFILE="/var/run/spamd.pid"
CRON=0
----------------------------------------------------------------
SAVE+EXIT
# run ...
tc: /usr/sbin/spamd -d
# see the process is running by
tc: pgrep spamd
++
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
STEP: 23- Install Clamav Anti Virus
tc: groupadd clamav
tc: useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav
tc: groupadd qscand
tc: useradd -g qscand -s /bin/false -c "Qmail-Scanner Account" qscand
tc: cd /opt/qmail-install/
tc: tar zxvf clamav-0.95.3.tar.gz
tc: cd clamav-0.95.3/
tc: ./configure
tc: make
tc: make install
tc: cd /usr/local/etc/
tc: cp clamd.conf clamd.conf.ori
tc: cp freshclam.conf freshclam.conf.ori
tc: echo "" > clamd.conf
tc: vim clamd.conf
----------------------------------------------------------------
LogFile /var/log/clamav/clamd.log
LogTime yes
LogSyslog yes
PidFile /var/run/clamav/clamd.pid
DatabaseDirectory /var/lib/clamav
LocalSocket /var/lib/clamav/clamd.socket
User qscand
AllowSupplementaryGroups yes
ScanMail yes
PhishingSignatures yes
PhishingScanURLs yes
----------------------------------------------------------------
SAVE+EXIT
tc: echo "" >freshclam.conf
tc: vim freshclam.conf
----------------------------------------------------------------
DatabaseDirectory /var/lib/clamav
UpdateLogFile /var/log/clamav/freshclam.log
LogFileMaxSize 2M
LogTime yes
LogSyslog yes
PidFile /var/run/clamav/freshclam.pid
DatabaseOwner qscand
DNSDatabaseInfo current.cvd.clamav.net
DatabaseMirror database.clamav.net
MaxAttempts 5
ScriptedUpdates yes
NotifyClamd /usr/local/etc/clamd.conf
----------------------------------------------------------------
SAVE+EXIT
tc: mkdir -p /var/log/clamav
tc: touch /var/log/clamav/clamd.log
tc: touch /var/log/clamav/freshclam.log
tc: chmod 777 /var/log/clamav/clamd.log
tc: chmod 777 /var/log/clamav/freshclam.log
tc: mkdir -p /var/run/clamav
tc: chown -R qscand:qscand /var/log/clamav
tc: chown -R qscand:qscand /var/run/clamav
tc: usermod -g qscand clamav
tc: mkdir -p /var/lib/clamav
tc: chown -R qscand:qscand /var/lib/clamav
tc: vim /etc/crontab
-------------------------------------------------------------------------------------------------
20 4 * * * root /usr/local/bin/freshclam -d -c 1 -l /var/log/clamav/freshclam.log
-------------------------------------------------------------------------------------------------
Save+Exit
tc: apt-get -q -y install libclamav6
tc: /usr/local/bin/freshclam -l /var/log/clamav/freshclam.log # wait until update done
# run ...
tc: /usr/local/sbin/clamd # add this line in /etc/rc.local
tc: /usr/local/bin/freshclam -l /var/log/clamav/freshclam.log # to check update
tc: vim /etc/rc.local # add the following line...
----------------------------
/usr/local/sbin/clamd
----------------------------
SAVE+EXIT
+++
STEP: 24- Install Qmail-Scanner and Integrate with clamd+spamd
tc: cd /opt/qmail-install
tc: tar zxvf q-s-2.08st-20091012.tgz
tc: cd qmail-scanner-2.08st/
tc: cp /opt/qmail-install/qms-config /opt/qmail-install/qmail-scanner-2.08st/
tc: vim qms-config
# ... Please change domain name "linux-bd.com" as your own
----------------------------------------------------------------
# qms-config file ...
./configure --domain "linux-bd.com" \
--admin postmaster \
--local-domains "linux-bd.com" \
--add-dscr-hdrs yes \
--dscr-hdrs-text "X-Antivirus-LINUXBD.COM" \
--ignore-eol-check yes \
--sa-quarantine 0.1 \
--sa-delete 5.0 \
--sa-reject no \
--sa-subject ":SPAM:" \
--sa-alt yes \
--sa-debug no \
--notify admin \
--redundant yes \
--silent-viruses auto \
--unzip 1 \
--archive 0 \
--log-details yes \
--fix-mime 1 \
--settings-per-domain yes \
"$INSTALL"
----------------------------------------------------------------
tc: chmod 755 qms-config
tc: ./qms-config # answer Y to all question
tc: ./qms-config install # answer Y to all question
tc: setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -z
tc: setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -g
tc: setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -p
tc: chown -R qscand:qscand /var/spool/qscan
# Testing the qmail-scanner; thait it is working properly or not ...
tc: chmod 755 /opt/qmail-install/qmail-scanner-2.08st/contrib/test_installation.sh
# run ...
tc: /opt/qmail-install/qmail-scanner-2.08st/contrib/test_installation.sh -doit
# Sample successfull output bellow ...
----------------------------------------------------------------------------------------------
Sending standard test message - no viruses... 1/4
done!
Sending eicar test virus - should be caught by perlscanner module... 2/4
done!
Sending eicar test virus with altered filename - should only be caught by commercial anti-virus modules (if you have any)... 3/4
done!
Sending bad spam message fors anti-spam testing - In case you are using SpamAssassin... 4/4
If you have enabled $sa_quarantine, $sa_delete or $sa_reject the
spam-message wont arrive to the recipients. But if you have enabled
(good idea!) 'minidebug' or 'debug' you should check
/var/spool/qscan/qmail-queue.log (or where ever you have the log).
Done!
Finished test. Now go and check Email sent to "postmaster@linux-bd.com" and/or the log..
------------------------------------------------------------------------------------------------
# Now to activate the qmail fileter, activate the following line (I put a hash initially), just remove the hash (#)
"QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl"; export QMAILQUEUE" in the file "vim /var/qmail/supervise/qmail-smtpd/run"
... you may also find the line "/usr/local/bin/rblsmtpd -b -r bl.spamcop.net -r zen.spamhaus.org -r dnsbl.sorbs.net " ;
... where you add more dnsbl filtering and it is very good to protect spam.
... softlimit defines total mail processing size I set it to 12MB (softlimit -m 120000000); you may change it
and then Save+Exit
after saving my final "/var/qmail/supervise/qmail-smtpd/run"
------------------------------------------------------------------------------------------------------
#!/bin/sh
QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl"; export QMAILQUEUE
QMAILDUID=`id -u vpopmail`
NOFILESGID=`id -g vpopmail`
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
LOCAL=`head -1 /var/qmail/control/me`
if [ -z "$QMAILDUID" -o -z "$NOFILESGID" -o -z "$MAXSMTPD" -o -z "$LOCAL" ]; then
echo QMAILDUID, NOFILESGID, MAXSMTPD, or LOCAL is unset in
echo /var/qmail/supervise/qmail-smtpd/run
exit 1
fi
if [ ! -f /var/qmail/control/rcpthosts ]; then
echo "No /var/qmail/control/rcpthosts!"
echo "Refusing to start SMTP listener because it'll create an open relay"
exit 1
fi
exec /usr/local/bin/softlimit -m 120000000 \
/usr/local/bin/tcpserver -v -R -H -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \
-u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \
/usr/local/bin/rblsmtpd -b -r bl.spamcop.net -r zen.spamhaus.org -r dnsbl.sorbs.net \
/var/qmail/bin/qmail-smtpd mail.linux-bd.com \
/var/qmail/bin/qmail-smtpd 2>&1
------------------------------------------------------------------------------------------------------
tc: reboot
# reloading qmail service
tc: qmailctl stop
tc: qmailctl cdb
tc: qmailctl start
# Finally Check your /etc/rc.local files ...
tc: vim /etc/rc.local
----------------------------------------------------------------
# you should have the following lines ...
/usr/local/sbin/authdaemond start
/etc/init.d/imap start
/etc/init.d/imaps start
/usr/sbin/spamd -d
/usr/local/sbin/clamd
# csh -cf '/command/svscanboot &' <this line must be disabled>
exit 0 # this line "exit 0" should be at the end of rc.local file
----------------------------------------------------------------
# NOW REBOOT YOUR SERVER and CHECK EVERYTHING THAT THEY ARE WORKING OR NOT...
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
STEP: 25- Watching the log files ...
tc: tail -f /var/log/qmail/qmail-send/current # qmail send/receive log
tc: tail -f /var/log/qmail/qmail-smtpd/current # qmail smtp log
tc: tail -f /var/log/qmail/qmail-pop3d/current # qmail pop3 log
tc: tail -f /var/spool/qscan/qmail-queue.log # qmail-scanner log
tc: qmailctl queue
tc: qmailctl stat
tc: qmailctl flush
OK; we all done to configure a mail-server with qmail...