################################
# 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
groupadd www
useradd -g www www
cd /usr/local/src/apache_1.3.31
./configure \
--prefix=/usr/local/apache \
--enable-module=so \
--enable-module=rewrite \
--enable-shared=rewrite \
--server-uid=www \
--server-gid=www
make
make install
################################
# 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 ########
chown -R root.www /usr/local/lib/php
chmod -R g-w,o-rwx /usr/local/lib/php
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 ########
rm -Rf /usr/local/apache/htdocs/*
rm -f /usr/local/apache/index.html.*
rm -Rf /usr/local/apache/cgi-bin/*
cd /usr/local
chown -R root.root apache
chmod 755 apache
chmod -R 600 apache/*
chmod -R u+X apache
cd apache
chmod -R u+x bin
chgrp -R www cgi-bin
chmod -R u+x,g+x cgi-bin
chgrp -R www icons
chmod -R g+rX icons
chgrp -R www logs
chmod g+wX logs
chgrp -R www htdocs
chmod -R g+rX htdocs
# 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
exit 0
######## End ########
chown root.root /etc/rc.d/init.d/httpd
chmod 744 /etc/rc.d/init.d/httpd
chkconfig --add httpd
################################
# Install vpopmial
################################
groupadd vchkpw
useradd -g vchkpw vpopmail
cd /usr/local/src
tar -xvzf vpopmail-5.4.0.tar.gz
chown -R root.root vpopmail-5.4.0
cd vpopmail-5.4.0
mkdir ~vpopmail/etc
chown vpopmail.vchkpw ~vpopmail/etc
echo "localhost|0|vpopmailuser|vpoppasswd|vpopmail" > ~vpopmail/etc/vpopmail.mysql
chown vpopmail.vchkpw ~vpopmail/etc/vpopmail.mysql
chmod 640 ~vpopmail/etc/vpopmail.mysql
/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
./configure \
--disable-roaming-users \
--enable-logging=p \
--disable-passwd \
--enable-clear-passwd \
--disable-domain-quotas \
--enable-auth-module=mysql \
--disable-many-domains \
--enable-auth-logging \
--enable-mysql-logging \
--enable-valias \
--disable-mysql-limits
make
make install-strip
vi ~vpopmail/etc/vlimits.default
default_quota 20971520 # Set the mail box default size 20M.
echo "myqmail.com" > /home/vpopmail/etc/defaultdomain
# 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
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 ########
cp quotawarn.msg /home/vpopmail/domains/.quotawarn.msg
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
cd qmailadmin-1.2.0
./configure \
--enable-htmldir=/usr/local/apache/htdocs \
--enable-cgibindir=/usr/local/apache/cgi-bin \
--enable-maxusersperpage=12 \
--enable-maxaliasesperpage=12 \
--enable-modify-quota \
--disable-ezmlm-mysql \
--disable-help
make
make install-strip
# Chinese qmailadmin
# Backup the orginal files.
mv /usr/local/share/qmailadmin/lang/en /usr/local/share/qmailadmin/lang/en_bak
mv /usr/local/src/qmailadmin_zh /usr/local/share/qmailadmin/lang/en
# Test the qmailadmin
http://mail.myqmail.com...mailadmin ################################
# Install sqwebmail
################################
cd /usr/local/src
tar -xvzf sqwebmail-3.5.3.tar.gz
chown -R root.root sqwebmail-3.5.3.tar.gz
cd sqwebmail-3.5.3
./configure \
--without-authpwd --without-authshadow --without-authpam \
--without-authuserdb --without-authldap --without-authdaemon \
--with-authvchkpw --with-fcgi --enable-unicode=gb2312 \
--enable-webpass=vpopmail \
--enable-cgibindir=/usr/local/apache/cgi-bin \
--enable-imagedir=/usr/local/apache/htdocs/images/webmail \
--enable-mimetypes=/usr/local/apache/htdocs \
--enable-mimecharset=gb2312 \
--with-defaultlang=zh
make
make install
make install-configure
cp -a /usr/local/apache/htdocs/images/webmail /usr/local/apache/htdocs/
mv -f /usr/local/src/zh-cn/* /usr/local/share/sqwebmail/html/zh-cn
mv /usr/local/src/images/webmail/* /usr/local/apache/htdocs/images/webmail/
# Test the webmail
[url]http://mail.myqmail.com/cgi-bin/sqwebmail [/url]
Download the source
* qmail, [url]http://www.qmail.org/netqmail-1.05.tar.gz [/url]
* ucspi-tcp, [url]ftp://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz [/url]
* daemontools, [url]ftp://cr.yp.to/daemontools/daemontools-0.76.tar.gz [/url]
References:
[url]http://www.lifewithqmail.org/lwq.html [/url]
[url]http://www.pipeline.com.au/staff/mbowe/isp/webmail-server.htm [/url]
http://cr....to