hac_ker@126.com
centos postfix extmail 安装和常见问题
1.. 安装
2.. 常见问题 (安装源码包courier-imap包)
操作系统 WebMail 系统 Web 账户管理后台 其它数据认证库 SMTP 认证库 POP3 认证库 CentOS 5.6 Extmail 1.1.0 Extman 1.0.0 courier-authlib 0.62..2 cyrus-sasl 2.1.22 CentOS和RHEL是一样的,而且升级免费 最新 邮件系统主程序 支持多语言、全部模板化,功能基本齐全 支持无限域名、无限用户 支持过滤和强大的功能 负责courier-imap,maildrop 的认证 标准的SASL实现库,支持courier authlib 邮件传输代理(MTA) Postfix 2.6.2 邮件投递代理(MDA) maildrop 2.0.4 courier-imap 4.5.0 Pop3 ,IMAP 认证功能
一、安装前准备
1.安装时加上mysql server ,其它以默认安装(如果安装时忘记安装mysql,可以运行 yum install mysql-server 来安装); 2.关闭防火墙; 3.关闭SELINUX
4.删除系统原来安好的sendmail # rpm -e --nodeps sendmail sendmail-cf
5.vi 使用高亮 # vi ~/.bashrc 中在alias下面另上一行 alias vi='vim' 后重启(这一步可有可无)
6.建立EMOS1.5 的YUM源
# vi /etc/yum.repos.d/EMOS-Base.repo #建立EMOS的库
# EMOS-Base.repo # # Created by ExtMail Dev Team: http://www.extmail.org/ # # $Id$ [EMOS-base] name=EMOS-Base baseurl=http://mirror.extmail.org/yum/emos/1.5/os/$basearch/ gpgcheck=0 priority=0 protect=0 hac_ker@126.com
[EMOS-update] name=EMOS-Updates baseurl=http://mirror.extmail.org/yum/emos/1.5/updates/$basearch/ gpgcheck=0 priority=0 protect=0 # yum clean all 保存退出后清空原来的记录
二、配置MTA—postfix
# yum install postfix #安装postfix 包
# postconf -n >/etc/postfix/main2.cf
# mv /etc/postfix/main.cf /etc/postfix/main.cf.bak # mv /etc/postfix/main2.cf /etc/postfix/main.cf
# vi /etc/postfix/main.cf #修改main.cf 配置文件
增加以下内容 # hostname mynetworks = 127.0.0.1 myhostname = mail.rookie.com mydestination = $mynetworks $myhostname # banner mail_name = Postfix - by extmail.org smtpd_banner = $myhostname ESMTP $mail_name # response immediately smtpd_error_sleep_time = 0s # Message and return code control message_size_limit = 5242880 mailbox_size_limit = 5242880 show_user_unknown_table_name = no # Queue lifetime control bounce_queue_lifetime = 1d maximal_queue_lifetime = 1d
hac_ker@126.com
三、配置courier-authlib
# yum install courier-authlib courier-authlib-mysql
修改authlib 配置文件
# rm -f /etc/authlib/authmysqlrc # vi /etc/authlib/authmysqlrc
MYSQL_SERVER localhost MYSQL_USERNAME extmail MYSQL_PASSWORD extmail MYSQL_SOCKET /var/lib/mysql/mysql.sock MYSQL_PORT 3306 MYSQL_OPT 0 MYSQL_DATABASE extmail MYSQL_USER_TABLE mailbox MYSQL_CRYPT_PWFIELD password MYSQL_UID_FIELD uidnumber MYSQL_GID_FIELD gidnumber MYSQL_LOGIN_FIELD username MYSQL_HOME_FIELD homedir MYSQL_NAME_FIELD name MYSQL_MAILDIR_FIELD maildir MYSQL_QUOTA_FIELD quota MYSQL_SELECT_CLAUSE SELECT username,password,\ CONCAT('/home/domains/',homedir), \\ CONCAT('/home/domains/',maildir), \\ quota, \\ name \\ FROM mailbox \\ WHERE username = '$(local_part)@$(domain)' 修改authmysqlrc 的权限和拥有者
# chown daemon.daemon /etc/authlib/authmysqlrc # chmod 660 /etc/authlib/authmysqlrc
修改authdaemonrc 以下内容 authmodulelist=\ authmodulelistorig=\ 启动
hac_ker@126.com
# service courier-authlib start
Starting Courier authentication services: authdaemond
修改authdaemon socket 目录权限,否则以下面的测试SMTP认证就不能通过 # chmod 755 /var/spool/authdaemon/
四、配置maildrop
# yum install maildrop
配置master.cf 为了使Postfix支持Maildrop,必须修改/etc/postfix/master.cf文件,注释掉原来的maildrop的配置内容,并改为: maildrop unix - n n - - pipe flags=DRhu user=vuser argv=maildrop -w 90 -d ${user}@${nexthop} ${recipient} ${user} ${extension} {nexthop}
配置main.cf 由于maildrop不支持一次接收多个收件人,因此必须在/etc/postfix/main.cf里增加如下参数: maildrop_destination_recipient_limit = 1
测试maildrop对authlib支持 # maildrop -v
注意事项:
1、如需重新编译Maildrop软件包,必须先获得其源码rpm包,并且必须先行安装courier-authlib及其devel软件包,否则编译后的maildrop将无法打开authlib支持。
2、 maildrop RPM包安装时,会自动创建vuser用户及vgroup用户组,专门用于邮件的存储,vuser:vgroup的uid/gid都是 1000,这与一般的邮件文档中提及用postfix用户存邮件不一样。因为postfix用户的uid一般都低于500,而Suexec模块编译时对 UID/GID的要求是要大于500,因此使用postfix用户不能满足要求。其次,如果用Maildrop作为投递代理(MDA),以postfix 身份投递的话,会导致postfix MTA错误。
五、配置apache
修改apache配置文件
# vi /etc/httpd/conf/httpd.conf 在最后一行加上
hac_ker@126.com
NameVirtualHost *:80 Include conf/vhost_*.conf
新建vhost_extmail.conf
# vi /etc/httpd/conf/vhost_extmail.conf # VirtualHost for ExtMail Solution
设置apache开机启动 # chkconfig httpd on
六、配置 extmail+extman
安装extmail 和extman 自己安装的时候需要yum -y install perl-Unix-Syslog # yum install extsuite-webmail extsuite-webman
# cp /var/www/extsuite/extmail/webmail.cf.default /var/www/extsuite/extmail/webmail.cf
# vi /var/www/extsuite/extmail/webmail.cf 修改以下两项 SYS_MYSQL_USER = extmail SYS_MYSQL_PASS = extmail
更新cgi目录权限 由于SuEXEC的需要,必须将cgi目录修改成vuser:vgroup权限: # chown -R vuser:vgroup /var/www/extsuite/extmail/cgi/ # chown -R vuser:vgroup /var/www/extsuite/extman/cgi/
链接基本库到Extmail