安装前的准备工作 关闭selinux
yum先安装好以下组件:
yum -y install createrepo 制作yum仓库文件工具 yum -y install httpd
yum -y install mysql mysql-server mysql-devel 安装mysql数据库支持Extmail groupadd -g 1000 vgroup 配置好邮件虚拟组和用户 useradd -u 1000 -g 1000 -M vuser
1.下载EMOS镜像 # su - root # mkdir /path # cd /path
#wget http://210.21.119.141/EMOS_1.6_x86_64.iso
制作本地yum仓库 # mkdir /mnt/EMOS
# mount -o loop /path/EMOS_1.6_x86_64.iso /mnt/EMOS # cd /mnt # createrepo .
# cd /etc/yum.repos.d # mkdir backup
# mv *.repo ./backup # vi EMOS.repo 加入以下内容 [EMOS]
name=EMOS
baseurl=file:///mnt/ enabled=1 gpgcheck=0
# yum clean all # yum list
配置MTA-Postfix 1、检查postfix
CenOS6.4默认安装了postfix,并且可以支持mysql了,所以不用再安装了 #rpm -qa |grep postfix
postfix-2.6.6-2.2.el6_1.x86_64
2、配置postfix
# postconf -n > /etc/postfix/main2.cf
# mv /etc/postfix/main.cf /etc/postfix/main.cf.old # mv /etc/postfix/main2.cf /etc/postfix/main.cf #vi /etc/postfix/main.cf
增加以下内容 # hostname
mynetworks = 127.0.0.1
myhostname = mail.extmail.org
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 3、设置postfix开机自启 # chkconfig postfix on
六、安装Courier-Authlib 1、安装
# yum -y install courier-authlib
# yum -y install courier-authlib-mysql 2、修改配置
编辑/etc/authlib/authmysqlrc文件: 编辑前先清空先有配置文件
#echo \增加以下内容:
# 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)'
3、修改authdaemonrc文件 # vi /etc/authlib/authdaemonrc 修改如下内容:
authmodulelist=\
authmodulelistorig=\其他默认
4、启动courier-authlib
# service courier-authlib start
如一切正常,命令行将返回如下信息:
Starting Courier authentication services: authdaemond
修改authdaemon socket目录权限;如果该目录权限不正确修改,maildrop及postfix等将无法正确获取用户的信息及密码认证:
# chmod 755 /var/spool/authdaemon/
七、配置maildrop 1、安装maildrop
# yum –y 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}
注意:flags前面有“两个空格”
配置main.cf 由于maildrop不支持一次接收多个收件人,因此必须在main.cf里增加如下参数:
maildrop_destination_recipient_limit = 1
2、测试maildrop对authlib支持 #maildrop -v
maildrop 2.0.4 Copyright 1998-2005 Double Precision, Inc. GDBM extensions enabled.
Courier Authentication Library extension enabled. Maildir quota extension enabled.
This program is distributed under the terms of the GNU General Public License. See COPYING for additional information.
3、注意事项
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 1、虚拟主机设置 编辑httpd.conf文件:
# vi /etc/httpd/conf/httpd.conf 在最后一行加上: NameVirtualHost *:80
Include conf/vhost_*.conf
编辑 vhost_extmail.conf
# vi /etc/httpd/conf/vhost_extmail.conf
# VirtualHost for ExtMail Solution
ServerName mail.extmail.org #设置自己喜欢的域名 ServerAlias 192.168.18.101 #用IP可访问 DocumentRoot /var/www/extsuite/extmail/html/
ScriptAlias /extmail/cgi/ /var/www/extsuite/extmail/cgi/ Alias /extmail /var/www/extsuite/extmail/html/
ScriptAlias /extman/cgi/ /var/www/extsuite/extman/cgi/ Alias /extman /var/www/extsuite/extman/html/
# Suexec config
SuexecUserGroup vuser vgroup
设置apache开机启动 # chkconfig httpd on