Preparation: Login the system as root. mkdir -p /usr/local/src mkdir -p /package Move the files of installation, patches and scripts except daemontools-0.76.tar.gz to /usr/local/src Move daemontools-0.76.tar.gz to /package chmod 1755 /package
Start installation: cd /usr/local/src tar -xvzf netqmail-1.05.tar.gz cd netqmail-1.05 ./collate.sh # important sentence!!! cd .. tar -xvzf ucspi-tcp-0.88.tar.gz rm *.tar # optional, unless space is very tight
cd /package tar -xvzf daemontools-0.76.tar.gz rm *.tar # optional, again
cd /usr/local/src/netqmail-1.05/netqmail-1.05 make setup check
# If your DNS is configured properly, this script should be all you need at this point: ./config
# Or you can configure your domain. ./config-fast mail.myqmail.com
################################ # Install ucspi-tcp ################################ cd /usr/local/src/ucspi-tcp-0.88 patch < /usr/local/src/netqmail-1.05/other-patches/ucspi-tcp-0.88.errno.patch make make setup check
################################ # Install daemontools ################################ cd /package tar -xvzf daemontools-0.76.tar.gz cd /package/admin/daemontools-0.76/src patch < /usr/local/src/netqmail-1.05/other-patches/daemontools-0.76.errno.patch cd .. package/install
# Start qmail script vi /var/qmail/rc ######## Write the following section to file:/var/qmail/rc ######## #!/bin/sh # Using stdout for logging # Using control/defaultdelivery from qmail-local to deliver messages by default exec env - PATH="/var/qmail/bin:$PATH" \ qmail-start "`cat /var/qmail/control/defaultdelivery`" ######## End ########
# Create the supervise mkdir -p /var/qmail/supervise/qmail-send/log mkdir -p /var/qmail/supervise/qmail-smtpd/log
vi /var/qmail/supervise/qmail-send/run ######## Write the following section to file:/var/qmail/supervise/qmail-send/run ######## #!/bin/sh exec /var/qmail/rc ######## End ########
vi /var/qmail/supervise/qmail-send/log/run ######## Write the following section to file:/var/qmail/supervise/qmail-send/log/run ######## #!/bin/sh exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail ######## End ########
vi /var/qmail/supervise/qmail-smtpd/run ######## Write the following section to file:/var/qmail/supervise/qmail-smtpd/run ######## #!/bin/sh QMAILDUID=`id -u qmaild` NOFILESGID=`id -g qmaild` 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 2000000 \ /usr/local/bin/tcpserver -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \ -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp /var/qmail/bin/qmail-smtpd 2>&1 ######## End ########
vi /var/qmail/supervise/qmail-smtpd/log/run ######## Write the following section to file:/var/qmail/supervise/qmail-smtpd/log/run ######## #!/bin/sh exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail/smtpd ######## End ########
# Allow the local host to inject mail via SMTP: echo '127.:allow,RELAYCLIENT=""' >>/etc/tcp.smtp qmailctl cdb
# Stop and disable the installed MTA: /etc/init.d/sendmail stop /sbin/init.d/sendmail stop /etc/rc.d/init.d/sendmail stop
# Uninstall the sendmail: rpm -e --nodeps sendmail
# Verify that nothing is listening to the SMTP port (25): netstat -a | grep smtp # If something is running, make sure it's not qmail by doing: qmailctl stop # The repeat the netstat check: netstat -a | grep smtp
# Create these aliases "stone": echo stone > /var/qmail/alias/.qmail-root echo stone > /var/qmail/alias/.qmail-postmaster ln -s .qmail-postmaster /var/qmail/alias/.qmail-mailer-daemon chmod 644 /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-postmaster
# Start qmail service: qmailctl start
# Now qmail should now be running. You can run "qmailctl stat" to verify that the services are up and running: # qmailctl stat # And run "qmailctl cdb" to reload the /etc/tcp.smtp # qmailctl cdb
mkdir /var/qmail/supervise/qmail-pop3d vi /var/qmail/supervise/qmail-pop3d/run ######## Write the following section to file:/var/qmail/supervise/qmail-pop3d/run ######## #!/bin/sh exec /usr/local/bin/softlimit -m 3000000 \ /usr/local/bin/tcpserver -v -R -H -l 0 0 110 /var/qmail/bin/qmail-popup \ mail.myqmail.com /home/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir 2>&1 ######## End ########
mkdir /var/qmail/supervise/qmail-pop3d/log vi /var/qmail/supervise/qmail-pop3d/log/run ######## Write the following section to file:/var/qmail/supervise/qmail-pop3d/log/run ######## #!/bin/sh exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t \ /var/log/qmail/pop3d ######## End ########
vi /var/qmail/bin/qmailctl ######## Add the following section to "start" part of the file:/var/qmail/bin/qmailctl ######## if svok /service/qmail-pop3d ; then svc -u /service/qmail-pop3d /service/qmail-pop3d/log else echo qmail-pop3d supervise not running fi ######## End ########
######## Add the following section to "stop" part of the file:/var/qmail/bin/qmailctl ######## echo " qmail-pop3d" svc -d /service/qmail-pop3d /service/qmail-pop3d/log ######## End ########
######## Add the following section to "stat" part of the file:/var/qmail/bin/qmailctl ######## svstat /service/qmail-pop3d svstat /service/qmail-pop3d/log ######## End ########
######## Add the following section to "pause" part of the file:/var/qmail/bin/qmailctl ######## echo "Pausing qmail-pop3d" svc -p /service/qmail-pop3d ######## End ########
######## Add the following section to "cont" part of the file:/var/qmail/bin/qmailctl ######## echo "Continuing qmail-pop3d" svc -c /service/qmail-pop3d ######## End ########
######## Add the following section to "restart" part of the file:/var/qmail/bin/qmailctl ######## echo "* Restarting qmail-pop3d." svc -t /service/qmail-pop3d /service/qmail-pop3d/log ######## End ########
# Test the Installation: cd /usr/local/src sh inst_check # When everything looks right, inst_check will report: # Congratulations, your LWQ installation looks good!
################################ # Install mysql ################################ groupadd mysql useradd -g mysql mysql
cd /usr/local tar -xvzf /usr/local/src/mysql-standard-4.0.20-pc-linux-i686.tar.gz ln -s mysql-standard-4.0.20-pc-linux-i686 mysql
cd mysql scripts/mysql_install_db
cd .. chown -R root.mysql mysql-standard-4.0.20-pc-linux-i686 chmod -R 640 mysql chmod -R u+X,g+X mysql chmod -R ug+x mysql/bin chmod -R g+w mysql/data chmod -R u+x mysql/scripts
cp /usr/local/mysql/support-files/my-medium.cnf /usr/local/mysql/data/my.cnf chgrp mysql /usr/local/mysql/data/my.cnf
cd /usr/local/mysql bin/safe_mysqld --user=mysql &
# Set the root password /usr/local/mysql/bin/mysqladmin -u root password 'secret'
# Configure MySQL so it is running all the time from bootup onwards cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql chmod 744 /etc/rc.d/init.d/mysql chkconfig --add mysql
################################ # Install apache ################################ cd /usr/local/src chown -R root.root apache_1.3.31.tar.gz tar -xvzf apache_1.3.31.tar.gz
################################ # Install php ################################ cd /usr/local/src tar -xvzf php-4.3.7.tar.gz chown -R root.root php-4.3.7.tar.gz
cd php-4.3.7 ./configure \ --with-mysql=/usr/local/mysql \ --with-apxs=/usr/local/apache/bin/apxs
make make install
cp php.ini-dist /usr/local/lib/php.ini
vi /usr/local/lib/php.ini ######## Modify the /usr/local/lib/php.ini file and make sure it contains the following commands. ######## max_execution_time=60 memory_limit=10M post_max_size=8M upload_max_filesize=8M file_uploads=On log_errors=On error_log=/usr/local/apache/logs/php_error_log ######## End ########
vi /usr/local/apache/conf/httpd.conf ######## Modify the /usr/local/apache/conf/httpd.conf file and make sure it contains the following commands. ######## User www Group www ServerAdmin postmaster@myqmail.com ServerName mail.five-star.cn # Following line should be present already as it would be inserted by the PHP make # Make sure you move it outside of the IfDefineSSL section if the make (incorrectly) put it there LoadModule php4_module libexec/libphp4.so # uncomment (or add) the following line AddType application/x-httpd-php .php # Add the index.php into this line so apache will use this file as a default in addition to index.html DirectoryIndex index.php index.html ######## End ########
# Run apache every time at bootup. rm -rf /etc/rc.d/init.d/httpd
vi /etc/rc.d/init.d/httpd ######## Create the /etc/rc.d/init.d/httpd file with the following commands. ######## #!/bin/sh # # Startup script for the Apache Web Server # # chkconfig: 345 85 15 # description: Apache is a World Wide Web server. It is used to serve \ # HTML files and CGI. # processname: httpd # pidfile: /var/run/httpd.pid
# Source function library. ./etc/rc.d/init.d/functions
# See how we were called. case "$1" in start) echo -n "Starting httpd: " daemon /usr/local/apache/bin/httpd echo touch /var/lock/subsys/httpd ;; stop) echo -n "Shutting down http: " killproc httpd echo rm -f /var/lock/subsys/httpd rm -f /var/run/httpd.pid ;; status) status httpd ;; restart) $0 stop $0 start ;; reload) echo -n "Reloading httpd: " killproc httpd -HUP echo ;; *) echo "Usage: $0 {start|stop|restart|reload|status}" exit 1 esac
/usr/local/mysql/bin/mysql --password="secret" CREATE DATABASE vpopmail; GRANT select,insert,update,delete,create,drop ON vpopmail.* TO vpopmailuser@localhost IDENTIFIED BY 'vpoppasswd'; quit
# Setup the quota warning message that is sent to users when they are at 90% quota. vi quotawarn.msg ######## Create the quotawarn.msg file with the following commands. ######## From: SomeCompany Postmaster <postmaster@myqmail.com> Reply-To: postmaster@myqmail.com To: SomeCompany User:; Subject: Mail quota warning Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit
Your mailbox on the server is now more than 90% full.
So that you can continue to receive mail, you need to remove some messages from your mailbox.
If you require assistance with this, please contact our support department :
email : support@myqmail.com Tel : xx xxxx xxxx ######## End ########
echo "Message rejected. Not enough storage space in user's mailbox to accept message." > /home/vpopmail/domains/.over-quota.msg
# add a domain /home/vpopmail/bin/vadddomain myqmail.com myqmail
# add a test account /home/vpopmail/bin/vadduser stone@myqmail.com stone
# delete a user # /home/vpopmail/bin/vdeluser stone@myqmail.com
# delete a domain # /home/vpopmail/bin/vdeldomain myqmail.com
################################ # Install autoresponder ################################ cd /usr/local/src tar -xvzf autorespond-2.0.4.tar.gz chown -R root.root autorespond-2.0.4
cd autorespond-2.0.4 make make install
################################ # Install ezmlm / ezmlm-idx ################################ cd /usr/local/src tar -xvzf ezmlm-0.53.tar.gz chown -R root.root ezmlm-0.53
cd /usr/local/src tar -xvzf ezmlm-idx-0.40.tar.gz chown -R root.root ezmlm-idx-0.40
cp -R ezmlm-idx-0.40/* ezmlm-0.53/ # (you need to press y quite a few times to allow the patch files to overwrite the original files) cd ezmlm-0.53 patch < idx.patch patch -p1 < ../ezmlm-idx-0.53.400.unified_41.patch
make make man make setup
################################ # Install qmailadmin ################################ cd /usr/local/src tar -xvzf qmailadmin-1.2.0.tar.gz chown -R root.root qmailadmin-1.2.0