1. 下载相关的软件及组件
2. 安装apache
# cd /packages
# tar zxvf httpd-2[1].2.3.tar.gz
# ./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=all --with-mpm=worker --enable-deflate --enable-headers --with-mpm=worker --enable-proxy=shared --enable-ssl=shared --enable-modules=all
# make
# make install
# /usr/local/apache2/bin/apachectl start
测试:通过浏览器访问 http://127.0.0.1/,检查是否有apache页面显示。
====================================================================================================================================================
3. 安装mysql
# groupadd mysql
# useradd -g mysql mysql
# tar zxvf mysql-5.0.24.tar.gz
# cd mysql-5.0.24
# ./configure --prefix=/usr/local/mysql
# make
# make install
# cp support-files/my-medium.cnf /etc/my.cnf
# cd /usr/local/mysql
# bin/mysql_install_db --user=mysql (初始化mysql数据库)
# chown -R root .
# chown -R mysql var
# chgrp -R mysql .
# bin/mysqld_safe --user=mysql &
测试: # /usr/local/mysql/bin/mysql -A (是否能进入mysql)
# mysqladmin -u root password 123456 (将mysql的root用户密码设置为123456)
====================================================================================================================================================
4. 安装php
# tar zxvf php-5.1.4.tar.gz
# cd php-5.1.4
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/
# make
# make install
检查 apache配置文件/usr/local/apache2/conf/httpd.conf中 是否添加如下信息:
LoadModule php5_module libexec/libphp5.so (如果没有添加该信息,重新编译php)
在apache配置文件/usr/local/apache2/conf/httpd.conf中追加如下信息:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
重启apache
# /usr/local/apache2/bin/apachectl restart
测试:编辑一个php测试文件
# vi /usr/local/apache2/htdocs/index.php
<?php
phpinfo();
?>
通过浏览器访问如下信息,查看是否能看到php相关信息,如果能看到表明php与apache整合完成。
如果看到的是上面的源代码,说明有错误。
http://127.0.0.1/index.php
====================================================================================================================================================
5. Installing Qmail Itself
# cd /download
# tar zxvf qmailrocks.tar.gz
# /downloads/qmailrocks/scripts/install/qmr_install_linux-s1.script
# /downloads/qmailrocks/scripts/util/qmail_big_patches.script
Now we build Qmail...
# cd /usr/src/qmail/qmail-1.03
# make man && make setup check
# ./config-fast your_fqdn_hostname (ex: ./config-fast flg.wellsoon.com)
# make cert (generate a secure certificate that will be used to encrypt your server's TLS encrypted SMTP sessions...)
Here's a sample of my cert cert configs. Don't be an idiot. Substitute in your own information.
Country Name (2 letter code) [GB]:CN
State or Province Name (full name) [Berkshire]:Beijing
Locality Name (eg, city) [Newbury]:Beijing
Organization Name (eg, company) [My Company Ltd]:wellsoon
Organizational Unit Name (eg, section) []:Technology
Common Name (eg, your name or your server's hostname) []:flg.wellsoon.com
Email Address []:postmaster@thisdomain.org
# chown -R vpopmail:qmail /var/qmail/control/clientcert.pem /var/qmail/control/servercert.pem
Now we build ucspi-tcp...
# cd /usr/src/qmail/ucspi-tcp-0.88/
# patch < /downloads/qmailrocks/patches/ucspi-tcp-0.88.errno.patch
# make && make setup check
Now we build the 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
测试:
# ps -aux
If you see "svscanboot" running, you're in good shape.
====================================================================================================================================================
6. install Ezmlm
# cd /downloads/qmailrocks/
# tar zxvf ezmlm-0.53-idx-0.41.tar.gz
# cd ezmlm-0.53-idx-0.41
# make && make setup
If you don't get any errors, then ezmlm is all set up and ready to go!
====================================================================================================================================================
7. install Autoresponder
# cd /downloads/qmailrocks
# tar zxvf autorespond-2.0.5.tar.gz
# cd autorespond-2.0.5
# make && make install
If you don't get any errors, then autoresponder is all set up and ready to go!
====================================================================================================================================================
8. install Vpopmail (install vpopmail with MySQL integration)
# mkdir ~vpopmail/etc
# chown vpopmail:vchkpw ~vpopmail/etc
# echo "localhost|0|vpopuser|123456|vpopmail" > ~vpopmail/etc/vpopmail.mysql
# chown vpopmail:vchkpw ~vpopmail/etc/vpopmail.mysql
# chmod 640 ~vpopmail/etc/vpopmail.mysql
# mysql -u root -p (密码:123456)
mysql> CREATE DATABASE vpopmail;
mysql> GRANT select,insert,update,delete,create,drop ON vpopmail.* TO vpopuser@localhost IDENTIFIED BY '123456';
mysql> quit
Enter the vpopmail user's password when prompted. If you get in, you're golden.
# mysql -u vpopuser -p (密码:123456)
# cd /downloads/qmailrocks
# tar zxvf vpopmail-5.4.13.tar.gz
# cd vpopmail-5.4.13
# ./configure --enable-logging=p --enable-auth-module=mysql --disable-passwd --enable-clear-passwd --disable-many-domains --enable-auth-logging --enable-sql-logging --enable-valias --disable-mysql-limits
# make && make install-strip
If you don't get any errors, then Vpopmail is good to go!
====================================================================================================================================================
9. install Vqadmin
# cd /downloads/qmailrocks
# tar zxvf vqadmin-2.3.6.tar.gz
# cd vqadmin-2.3.6
# ./configure --enable-cgibindir=/usr/local/apache2/cgi-bin --enable-htmldir=/usr/local/apache2/htdocs
# make && make install-strip
Now you will need to add the following to your server's Apache configuration file (usually httpd.conf)
<Directory "/usr/local/apache2/cgi-bin/vqadmin">
deny from all
Options ExecCGI
AllowOverride AuthConfig
Order deny,allow
</Directory>
In addition, within the Apache master config file you will want to set the "AllowOveride" option to "All". Example: AllowOverride All
# cd /usr/local/apache2/cgi-bin/vqadmin
# vi .htaccess
AuthType Basic
AuthUserFile /usr/local/apache2/conf/vqadmin.passwd
AuthName vQadmin
require valid-user
satisfy any
# chown daemon .htaccess
# chmod 644 .htaccess
# ../../bin/htpasswd -bc /usr/local/apache2/conf/vqadmin.passwd admin 123456
# chmod 644 /usr/local/apache2/conf/vqadmin.passwd
# /usr/local/apache2/bin/apachectl stop
# /usr/local/apache2/bin/apachectl start
登录:http://192.168.1.215/cgi-bin/vqadmin/vqadmin.cgi
登录VqAdmin时,报服务器内部错误。原因:找不到libmysqlclient.so.15文件。处理方法如下:
# cp /usr/local/mysql/lib/mysql/libmysqlclient.so.15 /usr/lib
# cp /usr/local/mysql/lib/mysql/libmysqlclient.so.15 /usr/local/lib
=====================================================================================================================================================
10. install 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
====================================================================================================================================================
11. install Qmailadmin
Qmailadmin is going to provide us with a nice web based interface for administering mail accounts once they are setup through Vpopmail (or Vqadmin).
# tar zxvf qmailadmin-1.2.9.tar.gz
# cd qmailadmin-1.2.9
# ./configure --enable-cgibindir=/usr/local/apache2/cgi-bin --enable-htmldir=/usr/local/apache2/htdocs
# make && make install-strip
登录: http://192.168.1.215/cgi-bin/qmailadmin
====================================================================================================================================================
12. Finalizing Qmail
# /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: flg.qmail.com)
# vi /var/qmail/supervise/qmail-smtpd/run (Find "mail.example.com" and change it to your server's hostname. For example: flg.qmail.com)
# qmailctl stop
# echo '127.:allow,RELAYCLIENT=""' >> /etc/tcp.smtp
# qmailctl cdb
在执行 qmailctl cdb 指令时,若出现找不到 tcprules 指令时,重新安装 ucspi-tcp-0.88
原因:在安装 ucspi-tcp-0.88 时,忘记 patch < /downloads/qmailrocks/patches/daemontools-0.76.errno.patch
# echo /usr/local/maildir > /var/qmail/alias/.qmail-root
# echo /usr/local/maildir > /var/qmail/alias/.qmail-postmaster
# echo /usr/local/maildir > /var/qmail/alias/.qmail-mailer-daemon
# ln -s /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-anonymous
# chmod 644 /var/qmail/alias/.qmail*
Alright. We've got qmail ready to go. One of the last things we need to do is to disable/uninstall Sendmail on the server and replace the Sendmail binary with a symlink to qmail, so that our server won't freak out with Sendmail being gone.
====================================================================================================================================================
13. Uninstalling Sendmail/Postfix
First, you'll want to check and see if your Sendmail installation is an RPM installation or a source installation. A good way to tell, of couse, is to simply ask....
# rpm -qa | grep sendmail
If Sendmail is installed as an RPM, you will see an output similar to this:
sendmail-x.x.x.x
sendmail-doc-x.x.x.x
sendmail-devel-x.x.x.x
sendmail-cf-x.x.x.x
# /etc/rc.d/init.d/sendmail stop
# ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
# ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
====================================================================================================================================================
14. Starting qmail
# /downloads/qmailrocks/scripts/util/qmr_inst_check
If you get a "congratulations" type of message, you're all set.
# qmailctl stop
# qmailctl start
You can find out how things are running by:
# qmailctl stat
You should see an output like this:
-----------------------------------------------------
/service/qmail-send: up (pid 4201) 2759 seconds
/service/qmail-send/log: up (pid 4194) 2759 seconds
/service/qmail-smtpd: up (pid 4186) 2759 seconds
/service/qmail-smtpd/log: up (pid 4188) 2759 seconds
/service/qmail-pop3d: up (pid 4187) 2759 seconds
/service/qmail-pop3d/log: up (pid 4185) 2759 seconds
messages in queue: 1
messages in queue but not yet preprocessed: 0
-----------------------------------------------------
Let's test your new server's POP3 service...
# telnet localhost 110
you should see something like this:
-----------------------------------------------------
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK <4758.1238047907@flg.wellsoon.com>
user postmaster@flg.qmail.com (enter your username here. remember to use the full e-mail address)
+OK
pass 123456
+OK
quit
+OK
Connection closed by foreign host.
------------------------------------------------------
And now let's test your server's SMTP service to make sure the TLS functionaltiy is there...
# telnet localhost 25
-------------------------------------------------------
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 flg.wellsoon.com ESMTP
ehlo localhost
250-flg.wellsoon.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.
-------------------------------------------------------
=====================================================================================================================================================
15. Installing Courier-imap/imaps with Courierpassd
# tar jxvf courier-authlib-0.55.tar.bz2
# cd courier-authlib-0.55
# ./configure --prefix=/usr/local --exec-prefix=/user/local --with-authvchkpw --without-authldap --with-authmysql=/usr/local/mysql/lib/mysql/ --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
# tar jxvf courier-imap-4.0.2.tar.bz2
# useradd bsmith
# chown -R bsmith:wheel courier-imap-4.0.2
# cd courier-imap-4.0.2
# su bsmith
$ ./configure --prefix=/usr/local --exec-prefix=/usr/local --with-authvchkpw=/user/local/bin --without-authldap --with-authmysql=/usr/local/mysql/lib/mysql --disable-root-check --with-ssl --with-authchangeepwdir=/usr/local/libexec/authlib --with-redhat
$ make && make check
$ exit
# make install-strip && make install-configure
# /usr/local/sbin/mkimapdcert
# vi /usr/local/etc/imapd.cnf
change postmaser@example.com an administrative email address postmaster@flg.qmail.com
# 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
# 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"
# 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
# /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.
# telnet localhost 143
-------------------------------------------
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2005 Double Precision, Inc. See COPYING for distribution information.
a login postmaster@flg.qmail.com 123456
a OK LOGIN Ok.
a logout
* BYE Courier-IMAP server shutting down
a OK LOGOUT completed
Connection closed by foreign host.
-------------------------------------------
# tar zxvf courierpassd-1.1.0-RC1.tar.gz
# cd courierpassd-1.1.0-RC1
# ./configure
# make && make install
If your server uses Xinetd, here's how you integrate Courierpassd into it:
# cd /etc/xinetd.d/
Here we create the xinetd script for courierpassd...
# vi courierpassd
------------------------------------------
service courierpassd
{
port = 106
socket_type = stream
protocol = tcp
user = root
server = /usr/local/sbin/courierpassd
server_args = -s imap
wait = no
only_from = 127.0.0.1
instances = 4
disable = no
}
------------------------------------------
# vi /etc/services
Append to following line to the /etc/services file:
courierpassd 106/tcp #for /etc/xinetd.d/courierpassd
# /etc/rc.d/init.d/xinetd restart
# telnet localhost 106
-----------------------------------------------
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
200 courierpassd v1.1.0-RC1 hello, who are you?
user postmaster@flg.qmail.com
200 Your password please.
pass 123456
200 Your new password please.
newpass 123456
200 Password changed, thank-you.
quit
200 Bye.
Connection closed by foreign host.
-----------------------------------------------
====================================================================================================================================================
16. Installing Squirrelmail
# cd /packages/php-5.1.4/
# cp php.ini-dist /usr/local/lib/php.ini
# cd /usr/local/apache2/htdocs
# rz (上传squirrelmail-1.4.17.tar.gz)
# tar zxvf squirrelmail-1.4.17.tar.gz
# mv squirrelmail-1.4.17 webmail (将 squirrelmail 改名为 webmail)
# mkdir /var/sqattachements
# chown -R daemon:daemon /var/sqattachements (whatever user apache runs as.在 httpd.conf 文件中设置的 User:daemon,Group:daemon)
# cd /usr/local/apache2/htdocs/webmail/
# chown -R daemon:daemon data (whatever user apache runs as.在 httpd.conf 文件中设置的 User:daemon,Group:daemon)
# cd config
# ./conf.pl
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings
General
-------
1. Domain : flg.qmail.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 :
General Options
----------------
1. Data Directory : /usr/local/apache2/htdocs/webmail/data/
2. Attachment Directory : /var/local/squirrelmail/attach/
3. Directory Hash Level : 0
4. Default Left Size : 150
5. Usernames in Lowercase : false
6. Allow use of priority : true
7. Hide SM attributions : false
8. Allow use of receipts : true
9. Allow editing of identity : true
Allow editing of name : true
Remove username from header : false
10. Allow server thread sort : false
11. Allow server-side sorting : false
12. Allow server charset search : true
13. Enable UID support : true
14. PHP session name : SQMSESSID
15. Location base :
16. Only secure cookies if poss. : true
# cd /usr/local/apache2/config
# vi httpd.conf
edit the httpd.conf Apache configuration file and add the following block:
-----------------------------------------
<VirtualHost 192.168.1.215:80>
ServerName flg.wellsoon.com
ServerAlias mail.*
ServerAdmin postmaster@flg.qmail.com
DocumentRoot /usr/local/apache2/htdocs
</VirtualHost>
-----------------------------------------
http://flg.wellsoon.com/webmail/src/login.php
Username: postmaster@flg.qmail.com
Password: 123456
We're going to install the "change_pass" plugin which will allow our mail users to change their passwords from the Squirrelmail interface.
# cd /usr/local/apache2/htdocs/webmail/plugins
# rz (上传 checkpassword-0.90.tar.gz)
# tar zxvf change_pass-2.7-1.4.x.tar.gz
# rm -rf change_pass-2.7-1.4.x.tar.gz
# /usr/local/apache2/htdocs/webmail/config/conf.pl
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
Installed Plugins
1. change_pass
Available Plugins:
2. administrator
3. bug_report
4. calendar
5. delete_move_next
6. demo
7. filters
8. fortune
9. info
10. listcommands
11. mail_fetch
12. message_details
13. newmail
14. sent_subfolders
15. spamcop
16. squirrelspell
17. test
18. translate
=====================================================================================================================================================
17. 汉化qmail
# cd /packages
# tar zxvf zh_CN-1.4.4-(汉化).tar.gz
# ./install
指定squirrelmail的安装路径:/usr/loacl/apache2/htdocs/webmail
安装完成后配置:
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Language preferences
1. Default Language : zh_CN
2. Default Charset : gb2312
3. Enable lossy encoding : false
配置完成后重启apache
=====================================================================================================================================================
启动服务:(服务停止时候使用)
--------------------------------------------
# /usr/local/mysql/bin/mysqld_safe &
# /usr/local/apache2/bin/apachectl start
# /usr/local/sbin/authdaemond start
# /etc/rc.d/init.d/imap start
# /etc/rc.d/init.d/imaps start
--------------------------------------------
域名管理地址:
http://192.168.1.215/cgi-bin/vqadmin/vqadmin.cgi
邮箱用户管理地址:
http://192.168.1.215/cgi-bin/qmailadmin
用户登录地址:
http://192.168.1.215/webmail/src/login.php
-------------------------------------------------
修改 http.conf 文件,禁止浏览目录:
Options -Indexes FollowSymLinks
-------------------------------------------------
2. 安装apache
# cd /packages
# tar zxvf httpd-2[1].2.3.tar.gz
# ./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=all --with-mpm=worker --enable-deflate --enable-headers --with-mpm=worker --enable-proxy=shared --enable-ssl=shared --enable-modules=all
# make
# make install
# /usr/local/apache2/bin/apachectl start
测试:通过浏览器访问 http://127.0.0.1/,检查是否有apache页面显示。
====================================================================================================================================================
3. 安装mysql
# groupadd mysql
# useradd -g mysql mysql
# tar zxvf mysql-5.0.24.tar.gz
# cd mysql-5.0.24
# ./configure --prefix=/usr/local/mysql
# make
# make install
# cp support-files/my-medium.cnf /etc/my.cnf
# cd /usr/local/mysql
# bin/mysql_install_db --user=mysql (初始化mysql数据库)
# chown -R root .
# chown -R mysql var
# chgrp -R mysql .
# bin/mysqld_safe --user=mysql &
测试: # /usr/local/mysql/bin/mysql -A (是否能进入mysql)
# mysqladmin -u root password 123456 (将mysql的root用户密码设置为123456)
====================================================================================================================================================
4. 安装php
# tar zxvf php-5.1.4.tar.gz
# cd php-5.1.4
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/
# make
# make install
检查 apache配置文件/usr/local/apache2/conf/httpd.conf中 是否添加如下信息:
LoadModule php5_module libexec/libphp5.so (如果没有添加该信息,重新编译php)
在apache配置文件/usr/local/apache2/conf/httpd.conf中追加如下信息:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
重启apache
# /usr/local/apache2/bin/apachectl restart
测试:编辑一个php测试文件
# vi /usr/local/apache2/htdocs/index.php
<?php
phpinfo();
?>
通过浏览器访问如下信息,查看是否能看到php相关信息,如果能看到表明php与apache整合完成。
如果看到的是上面的源代码,说明有错误。
http://127.0.0.1/index.php
====================================================================================================================================================
5. Installing Qmail Itself
# cd /download
# tar zxvf qmailrocks.tar.gz
# /downloads/qmailrocks/scripts/install/qmr_install_linux-s1.script
# /downloads/qmailrocks/scripts/util/qmail_big_patches.script
Now we build Qmail...
# cd /usr/src/qmail/qmail-1.03
# make man && make setup check
# ./config-fast your_fqdn_hostname (ex: ./config-fast flg.wellsoon.com)
# make cert (generate a secure certificate that will be used to encrypt your server's TLS encrypted SMTP sessions...)
Here's a sample of my cert cert configs. Don't be an idiot. Substitute in your own information.
Country Name (2 letter code) [GB]:CN
State or Province Name (full name) [Berkshire]:Beijing
Locality Name (eg, city) [Newbury]:Beijing
Organization Name (eg, company) [My Company Ltd]:wellsoon
Organizational Unit Name (eg, section) []:Technology
Common Name (eg, your name or your server's hostname) []:flg.wellsoon.com
Email Address []:postmaster@thisdomain.org
# chown -R vpopmail:qmail /var/qmail/control/clientcert.pem /var/qmail/control/servercert.pem
Now we build ucspi-tcp...
# cd /usr/src/qmail/ucspi-tcp-0.88/
# patch < /downloads/qmailrocks/patches/ucspi-tcp-0.88.errno.patch
# make && make setup check
Now we build the 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
测试:
# ps -aux
If you see "svscanboot" running, you're in good shape.
====================================================================================================================================================
6. install Ezmlm
# cd /downloads/qmailrocks/
# tar zxvf ezmlm-0.53-idx-0.41.tar.gz
# cd ezmlm-0.53-idx-0.41
# make && make setup
If you don't get any errors, then ezmlm is all set up and ready to go!
====================================================================================================================================================
7. install Autoresponder
# cd /downloads/qmailrocks
# tar zxvf autorespond-2.0.5.tar.gz
# cd autorespond-2.0.5
# make && make install
If you don't get any errors, then autoresponder is all set up and ready to go!
====================================================================================================================================================
8. install Vpopmail (install vpopmail with MySQL integration)
# mkdir ~vpopmail/etc
# chown vpopmail:vchkpw ~vpopmail/etc
# echo "localhost|0|vpopuser|123456|vpopmail" > ~vpopmail/etc/vpopmail.mysql
# chown vpopmail:vchkpw ~vpopmail/etc/vpopmail.mysql
# chmod 640 ~vpopmail/etc/vpopmail.mysql
# mysql -u root -p (密码:123456)
mysql> CREATE DATABASE vpopmail;
mysql> GRANT select,insert,update,delete,create,drop ON vpopmail.* TO vpopuser@localhost IDENTIFIED BY '123456';
mysql> quit
Enter the vpopmail user's password when prompted. If you get in, you're golden.
# mysql -u vpopuser -p (密码:123456)
# cd /downloads/qmailrocks
# tar zxvf vpopmail-5.4.13.tar.gz
# cd vpopmail-5.4.13
# ./configure --enable-logging=p --enable-auth-module=mysql --disable-passwd --enable-clear-passwd --disable-many-domains --enable-auth-logging --enable-sql-logging --enable-valias --disable-mysql-limits
# make && make install-strip
If you don't get any errors, then Vpopmail is good to go!
====================================================================================================================================================
9. install Vqadmin
# cd /downloads/qmailrocks
# tar zxvf vqadmin-2.3.6.tar.gz
# cd vqadmin-2.3.6
# ./configure --enable-cgibindir=/usr/local/apache2/cgi-bin --enable-htmldir=/usr/local/apache2/htdocs
# make && make install-strip
Now you will need to add the following to your server's Apache configuration file (usually httpd.conf)
<Directory "/usr/local/apache2/cgi-bin/vqadmin">
deny from all
Options ExecCGI
AllowOverride AuthConfig
Order deny,allow
</Directory>
In addition, within the Apache master config file you will want to set the "AllowOveride" option to "All". Example: AllowOverride All
# cd /usr/local/apache2/cgi-bin/vqadmin
# vi .htaccess
AuthType Basic
AuthUserFile /usr/local/apache2/conf/vqadmin.passwd
AuthName vQadmin
require valid-user
satisfy any
# chown daemon .htaccess
# chmod 644 .htaccess
# ../../bin/htpasswd -bc /usr/local/apache2/conf/vqadmin.passwd admin 123456
# chmod 644 /usr/local/apache2/conf/vqadmin.passwd
# /usr/local/apache2/bin/apachectl stop
# /usr/local/apache2/bin/apachectl start
登录:http://192.168.1.215/cgi-bin/vqadmin/vqadmin.cgi
登录VqAdmin时,报服务器内部错误。原因:找不到libmysqlclient.so.15文件。处理方法如下:
# cp /usr/local/mysql/lib/mysql/libmysqlclient.so.15 /usr/lib
# cp /usr/local/mysql/lib/mysql/libmysqlclient.so.15 /usr/local/lib
=====================================================================================================================================================
10. install 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
====================================================================================================================================================
11. install Qmailadmin
Qmailadmin is going to provide us with a nice web based interface for administering mail accounts once they are setup through Vpopmail (or Vqadmin).
# tar zxvf qmailadmin-1.2.9.tar.gz
# cd qmailadmin-1.2.9
# ./configure --enable-cgibindir=/usr/local/apache2/cgi-bin --enable-htmldir=/usr/local/apache2/htdocs
# make && make install-strip
登录: http://192.168.1.215/cgi-bin/qmailadmin
====================================================================================================================================================
12. Finalizing Qmail
# /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: flg.qmail.com)
# vi /var/qmail/supervise/qmail-smtpd/run (Find "mail.example.com" and change it to your server's hostname. For example: flg.qmail.com)
# qmailctl stop
# echo '127.:allow,RELAYCLIENT=""' >> /etc/tcp.smtp
# qmailctl cdb
在执行 qmailctl cdb 指令时,若出现找不到 tcprules 指令时,重新安装 ucspi-tcp-0.88
原因:在安装 ucspi-tcp-0.88 时,忘记 patch < /downloads/qmailrocks/patches/daemontools-0.76.errno.patch
# echo /usr/local/maildir > /var/qmail/alias/.qmail-root
# echo /usr/local/maildir > /var/qmail/alias/.qmail-postmaster
# echo /usr/local/maildir > /var/qmail/alias/.qmail-mailer-daemon
# ln -s /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-anonymous
# chmod 644 /var/qmail/alias/.qmail*
Alright. We've got qmail ready to go. One of the last things we need to do is to disable/uninstall Sendmail on the server and replace the Sendmail binary with a symlink to qmail, so that our server won't freak out with Sendmail being gone.
====================================================================================================================================================
13. Uninstalling Sendmail/Postfix
First, you'll want to check and see if your Sendmail installation is an RPM installation or a source installation. A good way to tell, of couse, is to simply ask....
# rpm -qa | grep sendmail
If Sendmail is installed as an RPM, you will see an output similar to this:
sendmail-x.x.x.x
sendmail-doc-x.x.x.x
sendmail-devel-x.x.x.x
sendmail-cf-x.x.x.x
# /etc/rc.d/init.d/sendmail stop
# ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
# ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
====================================================================================================================================================
14. Starting qmail
# /downloads/qmailrocks/scripts/util/qmr_inst_check
If you get a "congratulations" type of message, you're all set.
# qmailctl stop
# qmailctl start
You can find out how things are running by:
# qmailctl stat
You should see an output like this:
-----------------------------------------------------
/service/qmail-send: up (pid 4201) 2759 seconds
/service/qmail-send/log: up (pid 4194) 2759 seconds
/service/qmail-smtpd: up (pid 4186) 2759 seconds
/service/qmail-smtpd/log: up (pid 4188) 2759 seconds
/service/qmail-pop3d: up (pid 4187) 2759 seconds
/service/qmail-pop3d/log: up (pid 4185) 2759 seconds
messages in queue: 1
messages in queue but not yet preprocessed: 0
-----------------------------------------------------
Let's test your new server's POP3 service...
# telnet localhost 110
you should see something like this:
-----------------------------------------------------
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK <4758.1238047907@flg.wellsoon.com>
user postmaster@flg.qmail.com (enter your username here. remember to use the full e-mail address)
+OK
pass 123456
+OK
quit
+OK
Connection closed by foreign host.
------------------------------------------------------
And now let's test your server's SMTP service to make sure the TLS functionaltiy is there...
# telnet localhost 25
-------------------------------------------------------
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 flg.wellsoon.com ESMTP
ehlo localhost
250-flg.wellsoon.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.
-------------------------------------------------------
=====================================================================================================================================================
15. Installing Courier-imap/imaps with Courierpassd
# tar jxvf courier-authlib-0.55.tar.bz2
# cd courier-authlib-0.55
# ./configure --prefix=/usr/local --exec-prefix=/user/local --with-authvchkpw --without-authldap --with-authmysql=/usr/local/mysql/lib/mysql/ --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
# tar jxvf courier-imap-4.0.2.tar.bz2
# useradd bsmith
# chown -R bsmith:wheel courier-imap-4.0.2
# cd courier-imap-4.0.2
# su bsmith
$ ./configure --prefix=/usr/local --exec-prefix=/usr/local --with-authvchkpw=/user/local/bin --without-authldap --with-authmysql=/usr/local/mysql/lib/mysql --disable-root-check --with-ssl --with-authchangeepwdir=/usr/local/libexec/authlib --with-redhat
$ make && make check
$ exit
# make install-strip && make install-configure
# /usr/local/sbin/mkimapdcert
# vi /usr/local/etc/imapd.cnf
change postmaser@example.com an administrative email address postmaster@flg.qmail.com
# 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
# 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"
# 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
# /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.
# telnet localhost 143
-------------------------------------------
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2005 Double Precision, Inc. See COPYING for distribution information.
a login postmaster@flg.qmail.com 123456
a OK LOGIN Ok.
a logout
* BYE Courier-IMAP server shutting down
a OK LOGOUT completed
Connection closed by foreign host.
-------------------------------------------
# tar zxvf courierpassd-1.1.0-RC1.tar.gz
# cd courierpassd-1.1.0-RC1
# ./configure
# make && make install
If your server uses Xinetd, here's how you integrate Courierpassd into it:
# cd /etc/xinetd.d/
Here we create the xinetd script for courierpassd...
# vi courierpassd
------------------------------------------
service courierpassd
{
port = 106
socket_type = stream
protocol = tcp
user = root
server = /usr/local/sbin/courierpassd
server_args = -s imap
wait = no
only_from = 127.0.0.1
instances = 4
disable = no
}
------------------------------------------
# vi /etc/services
Append to following line to the /etc/services file:
courierpassd 106/tcp #for /etc/xinetd.d/courierpassd
# /etc/rc.d/init.d/xinetd restart
# telnet localhost 106
-----------------------------------------------
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
200 courierpassd v1.1.0-RC1 hello, who are you?
user postmaster@flg.qmail.com
200 Your password please.
pass 123456
200 Your new password please.
newpass 123456
200 Password changed, thank-you.
quit
200 Bye.
Connection closed by foreign host.
-----------------------------------------------
====================================================================================================================================================
16. Installing Squirrelmail
# cd /packages/php-5.1.4/
# cp php.ini-dist /usr/local/lib/php.ini
# cd /usr/local/apache2/htdocs
# rz (上传squirrelmail-1.4.17.tar.gz)
# tar zxvf squirrelmail-1.4.17.tar.gz
# mv squirrelmail-1.4.17 webmail (将 squirrelmail 改名为 webmail)
# mkdir /var/sqattachements
# chown -R daemon:daemon /var/sqattachements (whatever user apache runs as.在 httpd.conf 文件中设置的 User:daemon,Group:daemon)
# cd /usr/local/apache2/htdocs/webmail/
# chown -R daemon:daemon data (whatever user apache runs as.在 httpd.conf 文件中设置的 User:daemon,Group:daemon)
# cd config
# ./conf.pl
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings
General
-------
1. Domain : flg.qmail.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 :
General Options
----------------
1. Data Directory : /usr/local/apache2/htdocs/webmail/data/
2. Attachment Directory : /var/local/squirrelmail/attach/
3. Directory Hash Level : 0
4. Default Left Size : 150
5. Usernames in Lowercase : false
6. Allow use of priority : true
7. Hide SM attributions : false
8. Allow use of receipts : true
9. Allow editing of identity : true
Allow editing of name : true
Remove username from header : false
10. Allow server thread sort : false
11. Allow server-side sorting : false
12. Allow server charset search : true
13. Enable UID support : true
14. PHP session name : SQMSESSID
15. Location base :
16. Only secure cookies if poss. : true
# cd /usr/local/apache2/config
# vi httpd.conf
edit the httpd.conf Apache configuration file and add the following block:
-----------------------------------------
<VirtualHost 192.168.1.215:80>
ServerName flg.wellsoon.com
ServerAlias mail.*
ServerAdmin postmaster@flg.qmail.com
DocumentRoot /usr/local/apache2/htdocs
</VirtualHost>
-----------------------------------------
http://flg.wellsoon.com/webmail/src/login.php
Username: postmaster@flg.qmail.com
Password: 123456
We're going to install the "change_pass" plugin which will allow our mail users to change their passwords from the Squirrelmail interface.
# cd /usr/local/apache2/htdocs/webmail/plugins
# rz (上传 checkpassword-0.90.tar.gz)
# tar zxvf change_pass-2.7-1.4.x.tar.gz
# rm -rf change_pass-2.7-1.4.x.tar.gz
# /usr/local/apache2/htdocs/webmail/config/conf.pl
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
Installed Plugins
1. change_pass
Available Plugins:
2. administrator
3. bug_report
4. calendar
5. delete_move_next
6. demo
7. filters
8. fortune
9. info
10. listcommands
11. mail_fetch
12. message_details
13. newmail
14. sent_subfolders
15. spamcop
16. squirrelspell
17. test
18. translate
=====================================================================================================================================================
17. 汉化qmail
# cd /packages
# tar zxvf zh_CN-1.4.4-(汉化).tar.gz
# ./install
指定squirrelmail的安装路径:/usr/loacl/apache2/htdocs/webmail
安装完成后配置:
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Language preferences
1. Default Language : zh_CN
2. Default Charset : gb2312
3. Enable lossy encoding : false
配置完成后重启apache
=====================================================================================================================================================
启动服务:(服务停止时候使用)
--------------------------------------------
# /usr/local/mysql/bin/mysqld_safe &
# /usr/local/apache2/bin/apachectl start
# /usr/local/sbin/authdaemond start
# /etc/rc.d/init.d/imap start
# /etc/rc.d/init.d/imaps start
--------------------------------------------
域名管理地址:
http://192.168.1.215/cgi-bin/vqadmin/vqadmin.cgi
邮箱用户管理地址:
http://192.168.1.215/cgi-bin/qmailadmin
用户登录地址:
http://192.168.1.215/webmail/src/login.php
-------------------------------------------------
修改 http.conf 文件,禁止浏览目录:
Options -Indexes FollowSymLinks
-------------------------------------------------