Centos 6.2部署Extmail企业邮箱

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:
Extmail 是一个以perl语言编写,面向大容量/ISP级应用,免费的高性能Webmail软件,主要包括ExtMail、Extman两个部分的程序套件。ExtMail套件用于提供从浏览器中登录、使用邮件系统的Web操作界面,而Extman套件用于提供从浏览器中管理邮件系统的Web操作界面。它以GPL版权释出,设计初衷是希望设计一个适应当前高速发展的IT应用环境,满足用户多变的需求,能快速进行开发、改进和升级,适应能力强的webmail系统。
extmail,这个基于linux的webmail软件,我今天也在虚拟机里测试了一番,由于计算机的性能实在不佳,导致编译什么的耗时严重,到最后,甚至影响了我的心情,在本次部署的尾声,加上和朋友的交流过程中,发现这套邮件体系,在中国能找到的资料和能得到的支持是少之又少(算是个人见解)于是关于邮件带毒网关和后续的操作,我不打算继续研究了,另外,感谢博主斩月和博主我为技术狂,前者的文章在我部署中解决了不少困惑,后者将我从混乱思路拯救出来!
部署具体步骤如下:
本环境基于Centos 6.2 LAMP架构。如果你需要我lamp架构的部署流程可以参考我的另一篇博文 【图解】LAMP编译安装
1:使用验证库,可以使用mysql验证邮件账户
[root@chenyi1 phpMyadmin]# tar jxf /chenyi/courier-authlib-0.63.0.tar.bz2 -C /usr/src/
[root@chenyi1 phpMyadmin]# cd /usr/src/courier-authlib-0.63.0/
[root@chenyi1 courier-authlib-0.63.0]# groupadd postfix -g 1000
[root@chenyi1 courier-authlib-0.63.0]# groupadd vmail -g 1001
[root@chenyi1 courier-authlib-0.63.0]# groupadd postdrop -g 1002
[root@chenyi1 courier-authlib-0.63.0]# useradd  -u 1001  -g 1000 vmail
[root@chenyi1 courier-authlib-0.63.0]# useradd  -u 1000  -g 1000 postfix
[root@chenyi1 courier-authlib-0.63.0]# id vmail
查看相应的用户组关系
uid=1001(vmail) gid=1000(postfix) 组=1000(postfix)
[root@chenyi1 courier-authlib-0.63.0]# id postfix
uid=1000(postfix) gid=1000(postfix) 组=1000(postfix)
预配置
[root@chenyi1 courier-authlib-0.63.0]# ./configure    --prefix=/usr/local/courier-authlib --with-mailuser=vmail --with-mailgroup=vmail   --sysconfdir=/etc    --without-authpam    --without-authldap    --without-authpwd    --without-authshadow    --without-authvchkpw --without-authpgsql --with-authmysql    --with-mysql-libs=/usr/local/mysql/lib/mysql    --with-mysql-includes=/usr/local/mysql/include/mysql --with-redhat    --with-authmysqlrc=/etc/authmysqlrc --with-authdaemonrc=/etc/authdaemonrc    CFLAGS="-march=i686 -O2 -fexpensive-optimizations" CXXFLAGS="-march=i686 -O2 -fexpensive-optimizations"
如果在配置过程中没有报错,那么即可编译、安装了。
[root@chenyi1 courier-authlib-0.63.0]# make && make install
更新动态链接库(后面类似操作,不予解释)
[root@chenyi1 courier-authlib-0.63.0]# echo  '/usr/local/courier-authlib/lib/courier-authlib/' >> /etc/ld.so.conf  
[root@chenyi1 courier-authlib-0.63.0]# ldconfig
注意:如果是64位系统,这里需要将i686修改为x86-64,关于各种编译选项的含义可以使用./configure --help 来获取
2:修改authlib库相关配置文件
[root@chenyi1 courier-authlib-0.63.0]# cp /etc/authdaemonrc.dist /etc/authdaemonrc
[root@chenyi1 courier-authlib-0.63.0]# grep -v '^#' /etc/authdaemonrc | grep -v '^$'
authmodulelist="authmysql"				被grep筛选后的有效配置
authmodulelistorig="authmysql"
daemons=5
authdaemonvar=/usr/local/courier-authlib/var/spool/authdaemon
DEBUG_LOGIN=0
DEFAULTOPTIONS=""
LOGGEROPTS=""
[root@chenyi1 courier-authlib-0.63.0]# cp /etc/authmysqlrc.dist /etc/authmysqlrc
[root@chenyi1 courier-authlib-0.63.0]# grep -v '^#' /etc/authmysqlrc | grep -v '^$'
MYSQL_SERVER		127.0.0.1
MYSQL_USERNAME		extmail
MYSQL_PASSWORD		itchenyi
MYSQL_SOCKET		/tmp/mysql.sock
MYSQL_PORT		3306
MYSQL_OPT		0
MYSQL_DATABASE		extmail
MYSQL_USER_TABLE	mailbox
MYSQL_CRYPT_PWFIELD	password
MYSQL_UID_FIELD		1001
MYSQL_GID_FIELD		1001
MYSQL_LOGIN_FIELD	username
MYSQL_HOME_FIELD	concat('/email/mailbox/',homedir)
MYSQL_NAME_FIELD	name
MYSQL_MAILDIR_FIELD	concat('/email/mailbox/',maildir)
3:启动authlib服务
[root@chenyi1 courier-authlib-0.63.0]# /usr/local/courier-authlib/sbin/authdaemond start
[root@chenyi1 courier-authlib-0.63.0]# ps -aux | grep courier
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
root      7103  0.0  0.0   1980   464 ?        S    07:09   0:00 /usr/local/courier-authlib/sbin/courierlogger -pid=/usr/local/courier-authlib/var/spool/authdaemon/pid -start /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
root      7104  0.0  0.1   3636   880 ?        S    07:09   0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
root      7105  0.0  0.0   3636   300 ?        S    07:09   0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
root      7106  0.0  0.0   3636   300 ?        S    07:09   0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
root      7107  0.0  0.0   3636   300 ?        S    07:09   0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
root      7108  0.0  0.0   3636   300 ?        S    07:09   0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
root      7109  0.0  0.0   3636   300 ?        S    07:09   0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
root      7112  0.0  0.1   5952   736 pts/0    S+   07:09   0:00 grep courier
设置为开机启动
[root@chenyi1 courier-authlib-0.63.0]# echo '/usr/local/courier-authlib/sbin/authdaemond start' > /etc/rc.local
安装 cyrus-sasl,SASL (Simple Authentication Security Layer)简单认证安全层,功能主要是用于SMTP认证;而 Cyrus SASL是SASL的一个实现
1:卸载系统自带的sasl rpm包,使用--nodeps选项强制卸载
[root@chenyi1 courier-authlib-0.63.0]# rpm -qa | grep sasl
cyrus-sasl-plain-2.1.23-13.el6.i686
cyrus-sasl-devel-2.1.23-13.el6.i686
cyrus-sasl-lib-2.1.23-13.el6.i686
cyrus-sasl-md5-2.1.23-13.el6.i686
cyrus-sasl-2.1.23-13.el6.i686
[root@chenyi1 courier-authlib-0.63.0]# rpm -e $(rpm -qa | grep cyrus-sasl) --nodeps
[root@chenyi1 courier-authlib-0.63.0]# rpm -qa | grep sasl | wc -l
0
解包并进行预配置
[root@chenyi1 courier-authlib-0.63.0]# tar -zxf /chenyi/cyrus-sasl-2.1.22.tar.gz -C /usr/src/
[root@chenyi1 courier-authlib-0.63.0]# cd /usr/src/cyrus-sasl-2.1.22/
[root@chenyi1 cyrus-sasl-2.1.22]#  ./configure --prefix=/usr/local/sasl2 --with-mysql=/usr/local/mysql --disable-sample --disable-saslauthd --disable-pwcheck --disable-cram --disable-digest --disable-krb4 --disable-gssapi --disable-anon --enable-plain --enable-login --enable-sql --disable-ntlm --disable-otp --disable-srp --disable-srp-setpass --with-authdaemond=/usr/local/courier-authlib/var/spool/authdaemon/socket --with-mysql-includes=/usr/local/mysql/include/ --with-mysql-libs=/usr/local/mysql/lib/mysql
[root@chenyi1 cyrus-sasl-2.1.22]# make && make install
[root@chenyi1 cyrus-sasl-2.1.22]# ln -s /usr/local/sasl2/lib/sasl2/ /usr/lib
编辑ld.so.conf添加如下内容
[root@chenyi1 cyrus-sasl-2.1.22]# vi /etc/ld.so.conf
/usr/local/sasl2/lib/sasl2    
/usr/local/sasl2/lib
[root@chenyi1 cyrus-sasl-2.1.22]# ldconfig
编辑smtpd认证配置文件,此文件默认不存在
[root@chenyi1 cyrus-sasl-2.1.22]# vi /usr/local/sasl2/lib/sasl2/smtpd.conf 直接编辑该文件添加如下内容
pwcheck_method: authdaemond    
log_level: 3    
mech_list: PLAIN LOGIN    
authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket
创建相关目录并启动测试   第二条命令若停顿了,直接按Ctrl+C
[root@chenyi1 cyrus-sasl-2.1.22]# mkdir -p /var/state/saslauthd
[root@chenyi1 cyrus-sasl-2.1.22]# /usr/local/sasl2/sbin/saslauthd -a shadow pam -dsaslauthd[17673] :main            : num_procs  : 5
saslauthd[17673] :main            : mech_option: NULL
saslauthd[17673] :main            : run_path   : /var/state/saslauthd
saslauthd[17673] :main            : auth_mech  : shadow
saslauthd[17673] :ipc_init        : using accept lock file: /var/state/saslauthd/mux.accept
saslauthd[17673] :detach_tty      : master pid is: 0
saslauthd[17673] :ipc_init        : listening on socket: /var/state/saslauthd/mux
saslauthd[17673] :main            : using process model
saslauthd[17673] :have_baby       : forked child: 17675
saslauthd[17673] :have_baby       : forked child: 17676
saslauthd[17673] :have_baby       : forked child: 17677
saslauthd[17673] :have_baby       : forked child: 17678
saslauthd[17673] :get_accept_lock : acquired accept lock
^Csaslauthd[17678] :server_exit     : child exited: 17678
saslauthd[17673] :server_exit     : pid file lock removed: /var/state/saslauthd/saslauthd.pid.lock
saslauthd[17673] :ipc_cleanup     : accept lock file removed: /var/state/saslauthd/mux.accept
saslauthd[17673] :ipc_cleanup     : socket removed: /var/state/saslauthd/mux
saslauthd[17673] :server_exit     : master exited: 0
saslauthd[17677] :server_exit     : child exited: 17677
saslauthd[17675] :server_exit     : child exited: 17675
saslauthd[17676] :server_exit     : child exited: 17676
[root@chenyi1 cyrus-sasl-2.1.22]# /usr/local/sasl2/sbin/saslauthd -a shadow pam -d&
[root@chenyi1 ~]# ps aux | grep sasl
root     17690  0.0  0.1   2796   736 ?        S    07:39   0:00 /usr/local/sasl2/sbin/saslauthd -a shadow pam -d
root     17691  0.0  0.0   2796   472 ?        S    07:39   0:00 /usr/local/sasl2/sbin/saslauthd -a shadow pam -d
root     17692  0.0  0.0   2796   248 ?        S    07:39   0:00 /usr/local/sasl2/sbin/saslauthd -a shadow pam -d
root     17693  0.0  0.0   2796   248 ?        S    07:39   0:00 /usr/local/sasl2/sbin/saslauthd -a shadow pam -d
root     17694  0.0  0.0   2796   248 ?        S    07:39   0:00 /usr/local/sasl2/sbin/saslauthd -a shadow pam -d
root     17724  1.0  0.1   5952   736 pts/1    S+   07:40   0:00 grep sasl
[root@chenyi1 ~]# echo '/usr/local/sasl2/sbin/saslauthd -a shadow pam -d' >> /etc/rc.local
安装BerkeleyDB
卸载系统自带的db4 rpm包,这里需要使用--nodeps选项强制卸载
[root@chenyi1 ~]# rpm -qa | grep db4
db4-devel-4.7.25-16.el6.i686
db4-4.7.25-16.el6.i686
[root@chenyi1 ~]# rpm -e $(rpm -qa | grep db4) --nodeps
[root@chenyi1 ~]# rpm -qa | grep db4 | wc -l
0
[root@chenyi1 db-4.8.26]# cd /usr/src/db-4.8.26/build_unix/
[root@chenyi1 build_unix]# ../dist/configure --prefix=/usr/local/BerkeleyDB
[root@chenyi1 build_unix]# make && make install
[root@chenyi1 build_unix]# ln -s /usr/local/BerkeleyDB/include/ /usr/include/db4
[root@chenyi1 build_unix]# ln -s /usr/local/BerkeleyDB/include/db.h /usr/include/
[root@chenyi1 build_unix]# ln -s /usr/local/BerkeleyDB/include/db_cxx.h /usr/include/
[root@chenyi1 build_unix]# echo '/usr/local/BerkeleyDB/lib' >> /etc/ld.so.conf
[root@chenyi1 build_unix]# ldconfig
安装postfix
[root@chenyi1 build_unix]# echo '/usr/local/mysql/lib/mysql/' >> /etc/ld.so.conf
[root@chenyi1 build_unix]# ldconfig
[root@chenyi1 build_unix]# tar zxf /chenyi/postfix-2.8.0.tar.gz -C /usr/src/
[root@chenyi1 build_unix]# mv /chenyi/postfix-vda-2.8.0.patch /usr/src/postfix-2.8.0/
[root@chenyi1 build_unix]# cd /usr/src/postfix-2.8.0/
[root@chenyi1 postfix-2.8.0]# make clean
[root@chenyi1 postfix-2.8.0]# make tidy
[root@chenyi1 postfix-2.8.0]# patch -p1 < postfix-vda-2.8.0.patch
patching file README_FILES/VDA_README
patching file src/global/mail_params.h
patching file src/util/file_limit.c
patching file src/virtual/mailbox.c
patching file src/virtual/maildir.c
patching file src/virtual/virtual.c
patching file src/virtual/virtual.h
[root@chenyi1 postfix-2.8.0]# make -f Makefile.init Makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/local/sasl2/include/sasl' 'AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm -L/usr/local/sasl2/lib   -lsasl2 -L/usr/local/BerkeleyDB/lib'
[root@chenyi1 postfix-2.8.0]# make && make install  中途会出现交互。我也一并copy上来了
Please specify the prefix for installed file names. Specify this ONLY
if you are building ready-to-install packages for distribution to other
machines.
install_root: [/] 回车
Please specify a directory for scratch files while installing Postfix. You
must have write permission in this directory.
tempdir: [/usr/src/postfix-2.8.0] 回车
Please specify the final destination directory for installed Postfix
configuration files.
config_directory: [/etc/postfix] /usr/local/postfix/etc   
Please specify the final destination directory for installed Postfix
administrative commands. This directory should be in the command search
path of adminstrative users.
command_directory: [/usr/sbin] /usr/local/postfix/sbin
Please specify the final destination directory for installed Postfix
daemon programs. This directory should not be in the command search path
of any users.
daemon_directory: [/usr/libexec/postfix] /usr/local/postfix/libexec
Please specify the final destination directory for Postfix-writable
data files such as caches or random numbers. This directory should not
be shared with non-Postfix software.
data_directory: [/var/lib/postfix] /usr/local/postfix/var/lib
Please specify the destination directory for the Postfix HTML
files. Specify "no" if you do not want to install these files.
html_directory: [no] 回车
Please specify the owner of the Postfix queue. Specify an account with
numerical user ID and group ID values that are not used by any other
accounts on the system.
mail_owner: [postfix] 回车
Please specify the final destination pathname for the installed Postfix
mailq command. This is the Sendmail-compatible mail queue listing command.
mailq_path: [/usr/bin/mailq] 回车
Please specify the destination directory for the Postfix on-line manual
pages. You can no longer specify "no" here.
manpage_directory: [/usr/local/man] /usr/local/postfix/man
Please specify the final destination pathname for the installed Postfix
newaliases command. This is the Sendmail-compatible command to build
alias databases for the Postfix local delivery agent.
newaliases_path: [/usr/bin/newaliases] 回车
Please specify the final destination directory for Postfix queues.
queue_directory: [/var/spool/postfix] /usr/local/postfix/var/spool
Please specify the destination directory for the Postfix README
files. Specify "no" if you do not want to install these files.
readme_directory: [no] 回车
Please specify the final destination pathname for the installed Postfix
sendmail command. This is the Sendmail-compatible mail posting interface.
sendmail_path: [/usr/sbin/sendmail] 回车
Please specify the group for mail submission and for queue management
commands. Specify a group name with a numerical group ID that is
not shared with other accounts, not even with the Postfix mail_owner
account. You can no longer specify "no" here.
setgid_group: [postdrop] 回车
注:
make: *** [install] 错误 1  最后这里报错意,找不到/etc/postfix/main.cf,后面通过软链接进行解决,这里直接无视即可!
验证postfix是否支持sasl和mysql
[root@chenyi1 postfix-2.8.0]# ls /usr/local/postfix/
etc  libexec  man  sbin  var
[root@chenyi1 postfix-2.8.0]# ls /usr/local/postfix/etc/
access             canonical      LICENSE          makedefs.out  TLS_LICENSE
aliases            generic        main.cf          master.cf     transport
bounce.cf.default  header_checks  main.cf.default  relocated     virtual
[root@chenyi1 postfix-2.8.0]# mv /etc/aliases /tmp/aliases.old
[root@chenyi1 postfix-2.8.0]# ln -s /usr/local/postfix/etc/aliases /etc/
[root@chenyi1 postfix-2.8.0]# /usr/bin/newaliases
newaliases: fatal: open /etc/postfix/main.cf: No such file or directory
[root@chenyi1 postfix-2.8.0]# ln -s /usr/local/postfix/etc/main.cf /etc/po
[root@chenyi1 postfix-2.8.0]# mkdir /etc/postfix
[root@chenyi1 postfix-2.8.0]# ln -s /usr/local/postfix/etc/main.cf /etc/postfix/
[root@chenyi1 postfix-2.8.0]# /usr/bin/newaliases 
[root@chenyi1 postfix-2.8.0]# /usr/local/postfix/sbin/postconf -a
cyrus
dovecot
[root@chenyi1 postfix-2.8.0]# /usr/local/postfix/sbin/postconf -m |grep mysql
mysql
配置并启动postfix
[root@chenyi1 postfix-2.8.0]# cp /usr/local/postfix/etc/main.cf /usr/local/postfix/etc/main.cf.bak
[root@chenyi1 postfix-2.8.0]# rm -rf /etc/postfix/main.cf 
[root@chenyi1 postfix-2.8.0]# vi /etc/postfix/main.cf 将下面的内容复制进去,进行你需要的修改。
##====================MAIN========================  
myhostname = mail.itchenyi.com    
mydomain = itchenyi.com    
myorigin = $mydomain    
mydestination =    
inet_interfaces = all  
mynetworks = 192.168.1.0/24,192.168.10.0/24,127.0.0.0/8  
alias_maps =        hash:/etc/aliases     
alias_database =        hash:/etc/aliases     
queue_directory =   /usr/local/postfix/var/spool   
command_directory = /usr/local/postfix/sbin    
daemon_directory =  /usr/local/postfix/libexec    
sendmail_path =     /usr/sbin/sendmail    
newaliases_path =   /usr/bin/newaliases    
mailq_path =        /usr/bin/mailq    
setgid_group =      postdrop    
html_directory =    no    
manpage_directory = /usr/local/postfix/man    
sample_directory =  /usr/local/postfix/etc/    
readme_directory =  no    
unknown_local_recipient_reject_code = 550 
##====================SASL========================      
broken_sasl_auth_clients = yes    
smtpd_recipient_restrictions =  permit_mynetworks,    
 permit_sasl_authenticated,    
 reject_invalid_hostname,    
 reject_non_fqdn_hostname,    
 reject_unknown_sender_domain,    
 reject_non_fqdn_sender,    
 reject_non_fqdn_recipient,    
 reject_unknown_recipient_domain,    
 reject_unauth_pipelining,    
 reject_unauth_destination,    
 permit    
smtpd_sasl_auth_enable = yes    
smtpd_sasl_local_domain = $myhostname    
smtpd_sasl_security_options = noanonymous    
smtpdsmtpd_sasl_application_name = smtpd    
smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)    
##================ Virtual Mailbox Settings =====================#    
virtual_mailbox_base = /email/mailbox    
virtual_mailbox_maps = mysql:/usr/local/postfix/etc/mysql_virtual_mailbox_maps.cf    
virtual_mailbox_domains = mysql:/usr/local/postfix/etc/mysql_virtual_domains_maps.cf    
virtual_alias_domains = virtual_alias_maps = mysql:/usr/local/postfix/etc/mysql_virtual_alias_maps.cf    
virtual_uid_maps = static:1001    
virtual_gid_maps = static:1001    
virtual_transport = maildrop    
maildrop_destination_recipient_limit = 1    
maildrop_destination_concurrency_limit = 1    
message_size_limit = 14336000    
virtual_mailbox_limit = 20971520    
virtual_create_maildirsize = yes    
virtual_mailbox_extended = yes    
virtual_mailbox_limit_maps = mysql:/usr/local/postfix/etc/mysql_virtual_mailbox_limit_maps.cf 
virtual_mailbox_limit_override = yes    
virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please Tidy your mailbox and try again later.    
virtual_overquota_bounce = yes    
[root@chenyi1 postfix-2.8.0]# vi /usr/local/postfix/etc/mysql_virtual_domains_maps.cf
user = extmail    
password = itchenyi
hosts = localhost  
dbname = extmail   
table = domain  
select_field = description
where_field = domain
additional_conditions = AND active = '1'
[root@chenyi1 postfix-2.8.0]# vi /usr/local/postfix/etc/mysql_virtual_mailbox_maps.cf
user = extmail
password = itchenyi
hosts = localhost
dbname = extmail
table = mailbox
select_field = maildir
where_field = username
additional_conditions = AND active = '1'
[root@chenyi1 postfix-2.8.0]# vi /usr/local/postfix/etc/mysql_virtual_alias_maps.cf
user = extmail    
password = itchenyi
hosts = localhost
dbname = extmail
table = alias
select_field = goto  
where_field = address
additional_conditions = AND active = '1'
[root@chenyi1 postfix-2.8.0]# vi /usr/local/postfix/etc/mysql_virtual_limit_maps.cf
user = extmail    
password = itchenyi
hosts = localhost
dbname = extmail
table = mailbox
select_field = quota  
where_field = username
additional_conditions = AND active = '1'
[root@chenyi1 postfix-2.8.0]# /usr/local/postfix/sbin/postfix start
postfix/postfix-script: fatal: no /etc/postfix/master.cf file found
postfix/postfix-script: fatal: Postfix integrity check failed!
[root@chenyi1 postfix-2.8.0]# ll /etc/postfix/main.cf 
-rw-r--r--. 1 root root 2563 11月  8 08:29 /etc/postfix/main.cf
[root@chenyi1 postfix-2.8.0]# ln -s /usr/local/postfix/etc/master.cf /etc/postfix/[root@chenyi1 postfix-2.8.0]# /usr/local/postfix/sbin/postfix start
postfix/postfix-script: starting the Postfix mail system
[root@chenyi1 postfix-2.8.0]# netstat -pant | grep :25
tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN      2887/master
安装Courier-IMAP
[root@chenyi1 courier-authlib-0.63.0]# tar jxf /chenyi/courier-imap-4.9.3.tar.bz2 -C /usr/src/
[root@chenyi1 courier-authlib-0.63.0]# cd /usr/src/courier-imap-4.9.3/
[root@chenyi1 courier-imap-4.9.3]# ./configure --prefix=/usr/local/courier-imap --with-redhat --enable-unicode --disable-root-check --with-trashquota --without-ipv6 CPPFLAGS='-I/usr/local/courier-authlib/include' COURIERAUTHCONFIG='/usr/local/courier-authlib/bin/courierauthconfig'
[root@chenyi1 courier-imap-4.9.3]# make && make install
[root@chenyi1 courier-imap-4.9.3]# cd /usr/local/courier-imap/etc
[root@chenyi1 etc]# cp imapd.dist  imapd
[root@chenyi1 etc]# cp pop3d.dist pop3d
[root@chenyi1 etc]# cp imapd-ssl.dist  imapd-ssl
[root@chenyi1 etc]# cp pop3d-ssl.dist pop3d-ssl
[root@chenyi1 etc]# egrep -i 'path|start' pop3d |grep -v '^#'
POP3DSTART=YES		这里是对字段进行筛选,你需要修改pop3d文件,下面一样
MAILDIRPATH=/opt/mailbox
[root@chenyi1 etc]# egrep -i 'path|start' imapd |grep -v '^#'
IMAPDSTART=YES
MAILDIRPATH=/opt/mailbox
[root@chenyi1 etc]# cp /usr/src/courier-imap-4.9.3/courier-imap.sysvinit /etc/init.d/imapd
[root@chenyi1 etc]# chmod a+x /etc/init.d/imapd 
[root@chenyi1 etc]# chkconfig --add imapd
[root@chenyi1 etc]# service imapd start
Starting Courier-IMAP server: imap pop3
[root@chenyi1 etc]# netstat -pant | egrep '110|143'
tcp        0      0 0.0.0.0:110                 0.0.0.0:*                   LISTEN      21683/couriertcpd   
tcp        0      0 0.0.0.0:143                 0.0.0.0:*                   LISTEN      21677/couriertcpd
安装maildrop
[root@chenyi1 etc]# tar jxf /chenyi/maildrop-2.5.4.tar.bz2 -C /usr/src/
[root@chenyi1 etc]# cd /usr/src/maildrop-2.5.4/
[root@chenyi1 maildrop-2.5.4]# ./configure --enable-sendmail=/usr/sbin/sendmail  --enable-trusted-users='root vmail' --enable-syslog=1 --enable-maildirquota  --enable-maildrop-uid=1001  --enable-maildrop-gid=1001 --with-trashquota --with-dirsync
[root@chenyi1 maildrop-2.5.4]# make && make install
[root@chenyi1 maildrop-2.5.4]# maildrop -v
maildrop 2.5.4 Copyright 1998-2005 Double Precision, Inc.
GDBM/DB extensions enabled.
Maildir quota extension are now always enabled.
This program is distributed under the terms of the GNU General Public
License. See COPYING for additional information.
[root@chenyi1 maildrop-2.5.4]# vi /etc/maildroprc 直接编辑添加该文件(默认没有这个文件)加入以下内容
logfile "/var/log/maildrop.log"
[root@chenyi1 maildrop-2.5.4]# touch /var/log/maildrop.log
[root@chenyi1 maildrop-2.5.4]# chown vmail:vmail /var/log/maildrop.log
配置postfix 支持 maildrop (大约在master.cf文件的67和68左右,你需要去掉相应的注释)
[root@chenyi1 maildrop-2.5.4]# grep -2 -i 'maildrop' /etc/postfix/master.cf  |grep -v '^#'
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
[root@chenyi1 maildrop-2.5.4]# egrep '1001|maildrop' /etc/postfix/main.cf
virtual_uid_maps = static:1001    
virtual_gid_maps = static:1001    
virtual_transport = maildrop
配置Extman和Extmail等
配置Extman
[root@chenyi1 maildrop-2.5.4]# mkdir -p /email/mailbox
[root@chenyi1 maildrop-2.5.4]# chown -R vmail:vmail /email/mailbox/
[root@chenyi1 maildrop-2.5.4]# tar zxf /chenyi/extman-1.1.tar.gz -C /usr/src/
[root@chenyi1 maildrop-2.5.4]# mv /usr/src/extman-1.1/ /www/extman
[root@chenyi1 maildrop-2.5.4]# cp /www/extman/webman.cf.default /www/extman/webman.cf
[root@chenyi1 maildrop-2.5.4]# grep -v '^#' /www/extman/webman.cf | grep -v '^#'
SYS_CONFIG = /www/extman/  
SYS_LANGDIR = /www/extman/lang  
SYS_TEMPLDIR = /www/extman/html  
SYS_MAILDIR_BASE = /email/mailbox  
SYS_SHOW_WARN = 0 
SYS_SESS_DIR = /tmp/extman/  
SYS_APP_TYPE = ExtMan 
SYS_TEMPLATE_NAME = default 
SYS_DEFAULT_EXPIRE = 1y 
SYS_GROUPMAIL_SENDER = postmaster@extmail.org  
SYS_DEFAULT_SERVICES = webmail,smtpd,smtp,pop3,netdisk  
SYS_BACKEND_TYPE = mysql 
SYS_CRYPT_TYPE = md5crypt 
SYS_MYSQL_USER = extmail 
SYS_MYSQL_PASS = itchenyi
SYS_MYSQL_DB =   extmail 
SYS_MYSQL_HOST = localhost 
SYS_MYSQL_SOCKET = /tmp/mysql.sock  
SYS_MYSQL_TABLE = manager 
SYS_MYSQL_ATTR_USERNAME = username 
SYS_MYSQL_ATTR_PASSWD = password 
SYS_LDAP_BASE = dc=extmail.org  
SYS_LDAP_RDN = cn=Manager,dc=extmail.org  
SYS_LDAP_PASS = secret 
SYS_LDAP_HOST = localhost 
SYS_LDAP_ATTR_USERNAME = mail 
SYS_LDAP_ATTR_PASSWD = userPassword
[root@chenyi1 maildrop-2.5.4]# mkdir /tmp/extman
[root@chenyi1 maildrop-2.5.4]# chown vmail:vmail /www/extman/
[root@chenyi1 maildrop-2.5.4]# chown vmail:vmail /tmp/extman/
配置Extmail
[root@chenyi1 maildrop-2.5.4]# tar zxf /chenyi/extmail-1.2.tar.gz -C /www/
[root@chenyi1 maildrop-2.5.4]# mv /www/extmail-1.2/ /var/www/html/extmail[root@chenyi1 maildrop-2.5.4]# cp /www/extmail/webmail.cf.default /www/extmail/webmail.cf
[root@chenyi1 maildrop-2.5.4]# grep -v '^#' /www/extmail/webmail.cf | grep -v '^#'
SYS_CONFIG = /www/extmail/  
SYS_LANGDIR = /www/extmail/lang  
SYS_TEMPLDIR = /www/extmail/html  
SYS_HTTP_CACHE = 0
SYS_SMTP_HOST = 127.0.0.1
SYS_SMTP_PORT = 25 
SYS_LOG_FILE = /var/log/extmail.log  
SYS_SESS_TIMEOUT = 0 
SYS_SESS_COOKIE_ONLY = 1 
SYS_USER_PSIZE = 10 
SYS_USER_SCREEN = auto 
SYS_USER_LANG = en_US 
SYS_APP_TYPE = WebMail 
SYS_USER_TEMPLATE = default 
SYS_USER_CHARSET = utf-8  
SYS_AUTH_TYPE = mysql 
SYS_MAILDIR_BASE = /email/mailbox  
SYS_AUTH_SCHEMA = virtual 
SYS_CRYPT_TYPE = md5crypt 
SYS_MYSQL_USER = extmail 
SYS_MYSQL_PASS = itchenyi
SYS_MYSQL_DB = extmail 
SYS_MYSQL_HOST = localhost 
SYS_MYSQL_SOCKET = /tmp/mysql.sock  
SYS_MYSQL_TABLE = mailbox 
SYS_MYSQL_ATTR_USERNAME = username 
SYS_MYSQL_ATTR_DOMAIN = domain 
SYS_MYSQL_ATTR_PASSWD = password 
SYS_MYSQL_ATTR_CLEARPW = clearpwd
导入数据库文件
[root@chenyi1 maildrop-2.5.4]# cd /var/www/html/extman/docs/
[root@chenyi1 docs]# mysql -u root -p < extmail.sql 
Enter password: 
[root@chenyi1 docs]# mysql -u root -p < init.sql
Enter password:
[root@chenyi1 docs]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.0.56-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema | 
| extmail            | 
| mysql              | 
| test               | 
+--------------------+
4 rows in set (0.05 sec)
mysql> exit
Bye
[root@chenyi1 docs]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.0.56-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema | 
| extmail            | 
| mysql              | 
| test               | 
+--------------------+
4 rows in set (0.00 sec)
mysql> use extmail;
Database changed
mysql> show tables;
+-------------------+
| Tables_in_extmail |
+-------------------+
| alias             | 
| domain            | 
| domain_manager    | 
| mailbox           | 
| manager           | 
+-------------------+
5 rows in set (0.00 sec)
mysql> grant all privileges on extmail.* to extmail@'localhost' identified by 'itchenyi';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
配置slockd
[root@chenyi1 docs]# tar zxf /chenyi/slockd-0.99.tar.gz -C /usr/src/
[root@chenyi1 docs]# rm -rf /usr/src/slockd/
[root@chenyi1 docs]# tar zxf /chenyi/slockd-0.99.tar.gz -C /usr/local/
[root@chenyi1 docs]# /usr/local/slockd/slockd-init start
Starting spam locker daemon: slockd
[root@chenyi1 docs]# echo '/usr/local/slockd/slockd-init start' >> /etc/rc.local
[root@chenyi1 docs]# cd /var/run/
[root@chenyi1 run]# mkdir extmail
[root@chenyi1 run]# /var/www/html/extman/daemon/cmdserver -v -d
loaded ok
[root@chenyi1 run]# echo '/www/extman/daemon/cmdserver -v -d' >> /etc/rc.local
配置Apache
User vmail
Group vmail
在该配置文件末行加入
<VirtualHost *:80>     
         ServerName   mail.itchenyi.com     
         DocumentRoot /www/extmail/html         
         ScriptAlias  /extmail/cgi     /www/extmail/cgi    
         Alias        /extmail         /www/extmail/html   
         ScriptAlias  /extman/cgi      /www/extman/cgi   
         Alias        /extman          /www/extman/html          
        <Directory /www>         
         Authtype basic     
         Options execcgi     
         Options Indexes FollowSymLinks     
         AllowOverride None     
         Order allow,deny     
         Allow from all     
        </Directory>     
</VirtualHost>
到这里重启apache服务,你应该就可以使用默认的管理员帐号密码登录web了 extman默认管理帐号为:root@extmail.org   密码为:extmail*123*









本文转自 lgpqdwjh 51CTO博客,原文链接:http://blog.51cto.com/itchenyi/1122383,如需转载请自行联系原作者
相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
3月前
|
Linux
CentOS7.9服务器一键脚本部署FRP内网穿透服务端与客户端
CentOS7.9服务器一键脚本部署FRP内网穿透服务端与客户端
210 0
|
4月前
|
人工智能 JavaScript Linux
Nuxt.js在centos7上的发布部署
Nuxt.js在centos7上的发布部署
Nuxt.js在centos7上的发布部署
|
2月前
|
JavaScript Java 应用服务中间件
centos部署vue项目(java,tomcat环境的搭建)
centos部署vue项目(java,tomcat环境的搭建)
39 0
|
3月前
|
监控 安全 Linux
CentOS7下部署ARL资产侦察灯塔系统
CentOS7下部署ARL资产侦察灯塔系统
155 3
|
1月前
|
分布式计算 关系型数据库 MySQL
Sqoop【部署 01】CentOS Linux release 7.5 安装配置 sqoop-1.4.7 解决警告并验证(附Sqoop1+Sqoop2最新版安装包+MySQL驱动包资源)
【2月更文挑战第8天】Sqoop CentOS Linux release 7.5 安装配置 sqoop-1.4.7 解决警告并验证(附Sqoop1+Sqoop2最新版安装包+MySQL驱动包资源)
93 1
|
2月前
|
存储 NoSQL Linux
centos7部署redis以及多实例
centos7部署redis以及多实例
54 0
|
4天前
|
JavaScript Linux 数据安全/隐私保护
如何在CentOS7部署Wiki.js知识库并实现分享好友公网远程使用【内网穿透】
如何在CentOS7部署Wiki.js知识库并实现分享好友公网远程使用【内网穿透】
|
9天前
|
存储 Linux Shell
centos 部署docker容器 安装 、基本使用方法(一)
centos 部署docker容器 安装 、基本使用方法(一)
17 0
|
10天前
|
分布式计算 Hadoop Java
centos 部署Hadoop-3.0-高性能集群(一)安装
centos 部署Hadoop-3.0-高性能集群(一)安装
12 0
|
20天前
|
Linux Shell 开发工具
CentOS8中Docker安装及部署
CentOS8中Docker安装及部署
67 0

热门文章

最新文章