一、系统环境
(1)编译环境
[root@web_mail]# yum install gcc gcc-c++
(2)依赖软件
[root@web_mail]# yum install openssl openssl-devel cyrus-sasl libtool-ltdl libtool-ltdl-devel db4 db4-devel expect expect-devel pcre pcre-devel
(3)LAMP环境
[root@web_mail]# yum install httpd httpd-devel mysql mysql-server mysql-devel php php-mysql
(4)设置mysql,apache开机启动
[root@web_mail ~]# chkconfig mysqld on
[root@web_mail ~]# chkconfig httpd on
二、安装POSTFIX
(1)安装
[root@web_mail ~]# yum install postfix
(2)配置
[root@web_mail ~]# cd /etc/postfix/
[root@web_mail postfix]# postconf -n > /etc/postfix/main2.cf
[root@web_mail postfix]# mv main.cf main.cf.old
[root@web_mail postfix]# mv main2.cf main.cf
[root@web_mail postfix]# vi main.cf
|
(3)启动
[root@web_mail postfix]# service postfix start
[root@web_mail postfix]# chkconfig postfix on
[root@web_mail postfix]# ps aux|grep postfix
[root@web_mail postfix]# netstat -tlnp|grep 25
(4)检查
[root@web_mail postfix]# postfix check
[root@web_mail postfix]# postconf –a 出现cyrus表示可以支持cyrus认证用户
[root@web_mail postfix]# postconf -m 出现mysql表示可以支持mysql存储账号
三、安装Courier-Authlib
(1)安装
[root@web_mail postfix]# groupadd vmail -g 1002
[root@web_mail postfix]# useradd vmail -u 1002 -g 1002 -d /home/domains
[root@web_mail postfix]# cd /usr/local/src
[root@web_mail src]#wget http://cznic.dl.sourceforge.net/project/courier/authlib/0.66.1/
courier-authlib-0.66.1.tar.bz2
[root@web_mail src]# tar -jxf courier-authlib-0.66.1.tar.bz2
[root@web_mail src]# cd courier-authlib-0.66.1
[root@web_mail courier-authlib-0.66.1]# ./configure –with-mysql-libs –with-mysql-includes –with-authmysql –with-authmysql=yes –with-mailuser=vmail –with-mailgroup=vmail
[root@web_mail courier-authlib-0.66.1]# make && make install
[root@web_mail courier-authlib-0.66.1]# make install-configure
(2)修改配置文件
[root@web_mail courier-authlib-0.66.1]# cd /usr/local/etc/authlib
[root@web_mail authlib]# vi authmysqlrc
|
[root@web_mail authlib]# vi authdaemonrc
[root@web_mail authlib]# ln -s /usr/local/etc/authlib /etc/authlib
(3)启动
[root@web_mail authlib]# /usr/local/sbin/authdaemond start
[root@web_mail authlib]# ps aux|grep authdaemond
[root@web_mail authlib]# echo “/usr/local/sbin/authdaemond start” >> /etc/rc.d/rc.local
四、安装Maildrop
(1) 安装Courier-Unicode
[root@web_mail authlib]# cd /usr/local/src
[root@web_mail src]# tar -jxf courier-unicode-1.1.tar.bz2
[root@web_mail src]# cd courier-unicode-1.1
[root@web_mail courier-unicode-1.1]# ./configure
[root@web_mail courier-unicode-1.1]# make && make install
(2) 安装Maildrop
[root@web_mail courier-unicode-1.1]# cd /usr/local/src
[root@web_mail src]# tar -jxf maildrop-2.7.2.tar.bz2
[root@web_mail src]# cd maildrop-2.7.2
[root@web_mail maildrop-2.7.2]# ./configure
–enable-maildirquota –enable-maildrop-uid=1002 –enable-maildrop-gid=1002 –with-trashquota
[root@web_mail maildrop-2.7.2]# make && make install
(3) 配置
[root@web_mail maildrop-2.7.2]# vi /etc/postfix/master.cf
|
[root@web_mail maildrop-2.7.2]# vi /etc/postfix/main.cf
|
五、安装Webmail前台
(1)安装
[root@web_mail src]# tar -zxvf extmail-1.2.tar.gz
[root@web_mail src]# tar -zxvf extman-1.1.tar.gz
[root@web_mail src]# mkdir /var/www/extsuite
[root@web_mail src]# mv extman-1.1 /var/www/extsuite/extman
[root@web_mail src]# mv extmail-1.2 /var/www/extsuite/extmail
(2)配置extmail
[root@web_mail src]# cd /var/www/extsuite
[root@web_mail extsuite]# cp extmail/webmail.cf.default extmail/webmail.cf
[root@web_mail extsuite]# vi extmail/webmail.cf
|
(3)配置extman
[root@web_mail extsuite]# mkdir /var/www/extsuite/extman/session
[root@web_mail extsuite]# cp extman/webman.cf.default extman/webman.cf
[root@web_mail extsuite]# vi extman/webman.cf
|
(4)初始化数据库
[1] 给数据库root用户设置密码
[root@web_mail extsuite]# service mysqld restart
[root@web_mail extsuite]# mysql –uroot
mysql> set password for root@localhost=password(‘123456’);
mysql> quit
[2] 导入extmail数据库
[root@web_mail extsuite]# mysql -uroot -p123456 < extman/docs/extmail.sql
[3] 修改参数后导入数据
[root@web_mail extsuite]#sed –i ‘s/extmail.org/playdod.com/g’ extman/docs/init.sql
[root@web_mail extsuite]# sed -i ‘s/1000/1002/g’ extman/docs/init.sql
[root@web_mail extsuite]# mysql -uroot -p123456 </var/www/extsuite/extman/docs/init.sql
[4] 查看数据库
[root@web_mail extsuite]# mysql -uroot -p123456
mysql> use extmail;
> show tables;
mysql> select username,uidnumber,gidnumber from mailbox;
(5)配置postfix
[root@webmail extsuite]# cp extman/docs/mysql*.cf /etc/postfix/
[root@web_mail extsuite]# vi /etc/postfix/main.cf
|
(6)设置权限和属主
[root@web_mail extsuite]# chown root.root -R extmail extman
[root@web_mail extsuite]# chown -R vmail:vmail extmail/cgi/ extman/cgi/ extman/session
(7)配置Apache虚拟主机
[root@web_mail extsuite]# vi /etc/httpd/conf.d/extmail.conf
|
(8)重启服务
[root@web_mail extsuite]# service postfix restart
[root@web_mail extsuite]# service httpd restart
(9)建立Maildir
[1] 手动建立Maildir
|
[root@web_mail extsuite]# cd extman/tools
[root@web_mail tools]#
./maildirmake.pl /home/domains/playdod.com/postmaster/Maildir
[root@web_mail tools]# chown -R vmail:vmail /home/domains
[2]测试authlib认证登录账号
[root@web_mail tools]# /usr/local/sbin/authtest -s login postmaster@playdod.com extmail
(10)安装其他依赖包
[1]安装绘图工具
[root@web_mail tools]# yum install -y rrdtool rrdtool-perl
[2]安装依赖perl模块
[root@web_mail tools]# yum install -y cpan perl
[root@web_mail tools]# yum install -y perl-YAML perl-Test-Exception
perl-Crypt-PasswdMD5 perl-GD perl-CGI perl-Time-HiRes
[root@web_mail tools]# perl -MCPAN -e ‘install Time::HiRes::Value’
[root@web_mail tools]# perl -MCPAN -e ‘install File::Tail’
[root@web_mail tools]# perl -MCPAN -e ‘install Unix::Syslog’
[root@web_mail tools]# perl -MCPAN -e ‘install DB_File’
[root@web_mail tools]# perl -MCPAN -e ‘install Encode::HanExtra’
[3]启动进程
[root@web_mail tools]# cd /var/www/extsuite/extman
[root@web_mail extman]# cp -R addon/mailgraph_ext/ /usr/local/
[root@web_mail extman]# /usr/local/mailgraph_ext/mailgraph-init start
[root@web_mail extman]# ps aux|grep mailgraph_ext
[root@web_mail extman]# /var/www/extsuite/extman/daemon/cmdserver -v -d
[root@web_mail extman]# ps aux|grep cmdserver
[root@web_mail extman]#echo “/usr/local/mailgraph_ext/mailgraph-init
start” >> /etc/rc.d/rc.local
[root@web_mail extman]# echo “/var/www/extsuite/extman/daemon/cmdserver
-v -d” >> /etc/rc.d/rc.local
[4]定时任务
[root@web_mail extman]# crontab -e
|
[root@web_mail extman]# service crond restart
[root@web_mail extsuite]# vi /var/www/extsuite/extman/webman.cf 取消管理后台登陆验证码
|
(11)测试web访问
[1]访问邮箱
<1>帐号:postmaster1>
<2>密码:extmail2>
<3>域名:xxx.com3>
[2]访问邮箱后台
<1>帐号: root@xx.com1>
<2>密码: xxxx*2>
(12)检查Maildrop
[1]查看版本信息
[root@web_mail extsuite]# maildrop –v
[2]测试maildrop连接
[root@web_mail extsuite]# echo “test” | maildrop -V 10 -d postmaster@playdod.com
六、安装Cyrus-SASL使Postfix支持SMTP认证
(1)系统已默认安装Cyrus-SASL
[root@mail ~]# rpm -aq|grep cyrus-sasl
(2)配置cyrus-sasl
vi /etc/sasl2/smtpd.conf
[root@web_mail ~]# chmod 755 /usr/local/var/spool/authdaemon
(3)配置postfix
[root@web_mail ~]# vi /etc/postfix/main.cf
[root@web_mail ~]# service postfix restart
(4)测试SMTP认证
[root@web_mail ~]# perl -e ‘use MIME::Base64; print encode_base64
(“postmaster\@playdod.com”)’
[root@web_mail ~]# perl -e ‘use MIME::Base64; print encode_base64(“extmail”)’
[root@web_mail ~]# yum install -y telnet
[root@web_mail ~]# telnet localhost 25
|
七、实现POP3、IMAP基本功能
(1)安装Courier-IMAP
[root@web_mail ~]# cd /usr/local/src
[root@web_mail ~]#=wget http://ncu.dl.sourceforge.net/project/courier/imap/
4.15.1/courier-imap-4.15.1.tar.bz2
[root@web_mail src]# tar -jxf courier-imap-4.15.1.tar.bz2
[root@web_mail src]# cd courier-imap-4.15.1
[root@web_mail courier-imap-4.15.1]# ./configure –enable-workarounds-for-imap-client-bugs –with-authchangepwdir –enable-unicode –with-trashquota –disable-root-check
[root@web_mail courier-imap-4.15.1]# make && make install
[root@web_mail courier-imap-4.15.1]# make install-configure
(2)启动程序
[root@web_mail courier-imap-4.15.1]# cd /usr/lib/courier-imap/
[root@web_mail courier-imap]# /usr/lib/courier-imap/libexec/imapd.rc start
[root@web_mail courier-imap]# echo “/usr/lib/courier-imap/libexec/imapd.rc
start” >> /etc/rc.local
[root@web_mail courier-imap]# ps aux|grep imapd
[root@web_mail courier-imap]# netstat -tnlp|grep 143
[root@web_mail courier-imap]# /usr/lib/courier-imap/libexec/pop3d.rc start
[root@web_mail courier-imap]# echo “/usr/lib/courier-imap/libexec/pop3d.rc
start” >> /etc/rc.local
[root@web_mail courier-imap]# ps aux|grep pop3d
[root@web_mail courier-imap]# netstat -tnlp|grep 110
(3)设置imapd、pop3为启用状态
[root@web_mail courier-imap]# sed -i ‘s/IMAPDSTART=NO/IMAPDSTART=YES/g’ etc/imapd
[root@web_mail courier-imap]# sed -i ‘s/POP3DSTART=NO/POP3DSTART=YES/g’ etc/pop3d
(4)测试端口连接
[root@web_mail courier-imap]# telnet localhost 110
|
[root@web_mail courier-imap]# telnet localhost 143
|
八、Webmail支持FCGI
(1)装apache的mod_fastcgi模块
[root@web_mail ~]# yum install -y httpd-devel
[root@web_mail ~]# cd /usr/local/src
[root@web_mail src]# wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz
[root@web_mail src]# tar zxvf mod_fastcgi-2.4.6.tar.gz
[root@web_mail src]# cd mod_fastcgi-2.4.6
[root@web_mail mod_fastcgi-2.4.6]# cp Makefile.AP2 Makefile
[root@web_mail mod_fastcgi-2.4.6]# find / -name “build” -type d
[root@web_mail mod_fastcgi-2.4.6]# make top_dir=/usr/lib64/httpd/ install
(2)查看模块是否生成
[root@web_mail mod_fastcgi-2.4.6]# ls /etc/httpd/modules/mod_fastcgi.so
(3)安装Extmail需要的perl-FCGI模块
[root@web_mail mod_fastcgi-2.4.6]# yum install perl-FCGI
[root@web_mail mod_fastcgi-2.4.6]# vi /etc/httpd/conf.d/extmail.conf
(4)配置虚拟主机文件
/Users/yx/blog/source/F6F44294-9C5F-40E1-B9C6-FB25DA663BB4.png
(5)修改启动脚本,并启动
[root@web_mail mod_fastcgi-2.4.6]# vi /var/www/extsuite/extmail/dispatch-init
SU_UID=vmail
SU_GID=vmail
[root@web_mail mod_fastcgi-2.4.6]# /var/www/extsuite/extmail/dispatch-init start
[root@web_mail mod_fastcgi-2.4.6]# echo “/var/www/extsuite/extmail
/dispatch-init start” >> /etc/rc.d/rc.local
[root@web_mail mod_fastcgi-2.4.6]# service httpd restart
[root@web_mail mod_fastcgi-2.4.6]# ps aux|grep dispatch.fcgi
[root@web_mail mod_fastcgi-2.4.6]# netstat -tnlp|grep 8888