Part 10 - Uninstalling Sendmail/Postfix
卸载其他邮件MTA软件如sendmail和postfix
rpm -qa | grep sendmail
/etc/rc.d/init.d/sendmail stop
rpm -e --nodeps sendmail-x.x.x.x
rpm -e --nodeps sendmail-doc-x.x.x.x
rpm -e --nodeps sendmail-devel-x.x.x.x
rpm -e --nodeps sendmail-cf-x.x.x.x
rpm -qa | grep postfix
/etc/rc.d/init.d/postfix stop
rpm -e --nodeps postfix-x.x-x
ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
Part 11 - Starting qmail
安装脚本检查
/downloads/qmailrocks/scripts/util/qmr_inst_check
如果没有问题会现实检测成功
qmailctl stop
qmailctl start
qmailctl stat可以看到qmail的各个服务的状态
然后测试POP3和SMTP服务是否正常
telnet localhost 110
you should see something like this:
Trying 192.168.1.10...
Connected to 192.168.1.10.
Escape character is '^]'.
+OK <[email]16658.1054485137@yourserver.com[/email]>
user
postmaster@ mydomain.com
+OK
pass
your_password
+OK

quit
+OK
Connection closed by foreign host.
telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 somewhere.anywhere.com ESMTP
ehlo localhost
250-somewhere.anywhere.com
250-AUTH LOGIN CRAM-MD5 PLAIN
250-AUTH=LOGIN CRAM-MD5 PLAIN
250-STARTTLS
250-PIPELINING
250 8BITMIME
starttls
220 ready for tls
quit
quit
Connection closed by foreign host.
[root@somewhere control]#
 如果符合以上显示说明pop3和smpt服务正常
Part 12 - Installing Courier-imap/imaps with Courierpassd
cd /downloads/qmailrocks/
tar jxvf courier-authlib-0.55.tar.bz2
cd courier-authlib-0.55
./configure --prefix=/usr/local --exec-prefix=/usr/local --with-authvchkpw --without-authldap --without-authmysql --disable-root-check --with-ssl --with-authchangepwdir=/usr/local/libexec/authlib --with-redhat
make && make check
make install-strip && make install-configure
vi /etc/rc.local添加如下行
/usr/local/sbin/authdaemond start
建立一个非root用户 bsmith
useradd bsmith
cd /downloads/qmailrocks/
tar jxvf courier-imap-4.0.2.tar.bz2
chown -R bsmith:wheel courier-imap-4.0.2
cd /downloads/qmailrocks/courier-imap-4.0.2
su bsmith
./configure --prefix=/usr/local --exec-prefix=/usr/local --with-authvchkpw --without-authldap --without-authmysql --disable-root-check --with-ssl --with-authchangepwdir=/usr/local/libexec/authlib --with-redhat
make && make check
exit
make install-strip && make install-configure
生成证书
/usr/local/sbin/mkimapdcert
vi /usr/local/etc/imapd.cnf
修改 [email]postmaser@example.com[/email] 为管理员邮箱
vi /usr/local/etc/imapd
查找此行并修改为 IMAPDSTART=YES
MAXPERIP=4  把4改成更大的数字例如10
vi /usr/local/etc/imapd-ssl
查找此行并修改为 IMAPDSSLSTART=YES
 TLS_CERTFILE=/usr/local/share/imapd.pem
vi /usr/local/etc/authlib/authdaemonrc
修改27行为 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
测试IMAP服务
telnet localhost 143
Trying 192.168.1.10...
Connected to 192.168.1.10.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE STARTTLS] Courier-IMAP ready. Copyright 1998-2003 Double Precision, Inc. See COPYING for distribution information.
a login
[email]postmaster@mydomain.com[/email] my_password
a OK LOGIN Ok. (successful login!)
a logout (logs you out)
* BYE Courier-IMAP server shutting down
a OK LOGOUT completed
Connection closed by foreign host.
出现以上提示说明IMAP服务正常
cd /downloads/qmailrocks
tar zxvf courierpassd-1.1.0-RC1.tar.gz
cd courierpassd-1.1.0-RC1
./configure
make && make install
cd /etc/xinetd.d
建立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
}
编辑 /etc/services并添加如下内容
vi /etc/services
courierpassd 106/tcp #for /etc/xinetd.d/courierpassd
重启xinetd服务 /etc/rc.d/init.d/xinetd restart
测试
telnet localhost 106
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
200 courierpassd v0.30 hello, who are you?
user
postmaster@ mydomain.com
200 Your password please.
pass my_password

200 Your new password please.
newpass my_new_password

200 Password changed, thank-you.
quit
200 Bye.
Connection closed by foreign host.
出现上述提示说明服务正常
Part 13 - Installing Squirrelmail
cd /var/www/html
wget
squirrelmail-x.x.x.tar.gz
tar zxvf squirrelmail-x.x.x.tar.gz
mv squirrelmail-x.x.x webmail
mkdir /var/sqattachements
chown -R apache:apache /var/sqattachements
cd webmail
chown -R apache:apache data
cd config
./conf.pl
修改smtp认证方式为 login 修改Domain 为服务器IP
在http.conf中添加
<VirtualHost 1.2.3.4:80>
ServerName mail.mydomain.com

ServerAlias mail.*
ServerAdmin [email]postmaster@mydomain.com[/email]
DocumentRoot /var/www/html/webmail
</VirtualHost>
然后重启apache
测试
http:// [url]www.yourdomain.com[/url] /webmail
如果可以正常登录,说明松鼠邮件正确安装
安装插件
cd
/var/www/html/webmail/plugins
wget change_pass-2.7-1.4.x.tar.gz
tar zxvf change_pass-2.7-1.4.x.tar.gz
rm -rf change_pass-2.7-1.4.x.tar.gz
cd /var/www/html/webmail/ config
./conf.pl
选中新添加的plugin模块