系统结构:
Cd /etc/yum.repos.d
Mv *.repo bal/
Vi EMOS.repo
vim /etc/yum.repos.d/CentOS-Base.repo
remote = "http://mirror.extmail.org/yum/emos/1.5/os/i386/" + '/' + relative
rpm -e httpd mysql mysql-server cyrus-sasl cyrus-sasl-devel cyrus-sasl-lib cyrus-sasl-plain sendmail --nodeps
yum install -y httpd postfix mysql mysql-server php php-mysql php-mbstring php-mcrypt courier-authlib courier-authlib-mysql courier-imap maildrop cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain cyrus-sasl-devel extsuite-webmail extsuite-webman
yum -y install httpd mysql mysql-server php php-xml php-cli php-pdo php-mbstring php-mcrypt php-gd php-common php-devel php-mysql
[root@localhost~]# wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/2.11.10/phpMyAdmin-2.11.10-all-languages-utf-8-only.tar.gz/download
[root@localhost ~]# tar zxvf phpMyAdmin-2.11.10-all-languages-utf-8-only.tar.gz
[root@localhost ~]# mv phpMyAdmin-2.11.10-all-languages-utf-8-only phpmyadmin
[root@localhost ~]# cd phpmyadmin
[root@localhost phpmyadmin]# cp config.sample.inc.php config.inc.php
[root@localhost ~]# vim config.inc.php
$cfg['blowfish_secret'] = 'skssiwksksie'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
为了方便,下面所有的配置文件命令前的"[root@localhost ~]#"全部省略了
cd /etc/postfix
cp main.cf main.cf.bak
postconf -n > main1.cf
cp main1.cf main.cf
vi /etc/postfix/main.cf
mynetworks = 127.0.0.1
myhostname = mail.91ops.com
mydestination = $mynetworks $myhostname
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
# Queue lifetime control
bounce_queue_lifetime = 1d
maximal_queue_lifetime = 1d
vi /etc/authlib/authmysqlrc
MYSQL_SERVER localhost
MYSQL_USERNAME extmail
MYSQL_PASSWORD extmail
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_PORT 3306
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,"",uidnumber,gidnumber,\
CONCAT('/home/domains/',homedir), \
CONCAT('/home/domains/',maildir), \
FROM mailbox \
WHERE username = '$(local_part)@$(domain)'
vi /etc/authlib/authdaemonrc
chmod 755 /var/spool/authdaemon/
service courier-authlib start
Starting Courier authentication services: authdaemond
vim /etc/postfix/master.cf
maildrop unix - n n - - pipe
flags=DRhu user=vuser argv=maildrop -w 90 -d ${user}@${nexthop} ${recipient} ${user} ${extension} {nexthop}
vim /etc/postfix/main.cf
maildrop_destination_recipient_limit = 1
mv ~/phpmyadmin /var/www/extsuite/
vi /etc/httpd/conf/httpd.conf
NameVirtualHost *:80
# VirtualHost for ExtMail Solution
<VirtualHost *:80>
ServerName mail.extmail.org
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/
Alias /phpmyadmin /var/www/extsuite/phpmyadmin/
# Suexec config
SuexecUserGroup vuser vgroup
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using mail.91ops.com for ServerName
cd /var/www/extsuite/extmail
cp webmail.cf.default webmail.cf
vi webmail.cf
SYS_MYSQL_USER = extmail
SYS_MYSQL_PASS = extmail
SYS_MYSQL_DB = extmail
chown -R vuser:vgroup /var/www/extsuite/extmail/cgi/
chown -R vuser:vgroup /var/www/extsuite/extman/cgi/
mkdir /tmp/extman
chown -R vuser:vgroup /tmp/extman
service mysqld start
导入mysql数据库结构及初始化数据(如果前面没有更改mysql密码的话,root密码默认为空)
mysql -u root -p < /var/www/extsuite/extman/docs/extmail.sql
mysql -u root -p < /var/www/extsuite/extman/docs/init.sql
注:上述导入初始化SQL时,默认的uidnumber/gidnumber都是1000,这和vuser:vgroup 的uid/gid一致,是因为maildrop投递时会从数据库里取uidnumber/gidnumber,而在master.cf里已经定义好了投递时的运行身份(vuser:vgroup),所以这两个字段的内容必须为1000,否则将出现投递错误,例如报0×06等错误。
cd /var/www/extsuite/extman/docs
cp mysql_virtual_alias_maps.cf /etc/postfix/
cp mysql_virtual_domains_maps.cf /etc/postfix/
cp mysql_virtual_mailbox_maps.cf /etc/postfix/
cp mysql_virtual_sender_maps.cf /etc/postfix/
vi /etc/postfix/main.cf
# extmail config here
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_transport = maildrop:
/usr/sbin/authtest -s login [email protected] extmail
Authentication succeeded.
Authenticated: [email protected] (uid 1000, gid 1000)
Home Directory: /home/domains/extmail.org/postmaster
Maildir: /home/domains/extmail.org/postmaster/Maildir/
Quota: 104857600S
Encrypted Password: $1$phz1mRrj$3ok6BjeaoJYWDBsEPZb5C0
Cleartext Password: extmail
Options: (none)
/usr/local/mailgraph_ext/mailgraph-init start
/var/www/extsuite/extman/daemon/cmdserver --daemon
echo "/usr/local/mailgraph_ext/mailgraph-init start" >> /etc/rc.d/rc.local
echo "/var/www/extsuite/extman/daemon/cmdserver -v -d" >> /etc/rc.d/rc.local
vi /usr/lib/courier-imap/etc/imapd
vi /usr/lib/courier-imap/etc/imapd-ssl
然后重新启动courier-imap:service courier-imap start
为了下面的测试,请先启动httpd postfix
telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK Hello there.
user [email protected]
+OK Password required.
+OK logged in.
+OK POP3 clients that break here, they violate STD53.
+OK Bye-bye.
vi /etc/postfix/main.cf
# smtpd related config
smtpd_recipient_restrictions =
# SMTP sender login matching config
smtpd_sender_restrictions =
reject_authenticated_sender_login_mismatch,
reject_unauthenticated_sender_login_mismatch
smtpd_sender_login_maps =
mysql:/etc/postfix/mysql_virtual_sender_maps.cf,
# SMTP AUTH config here
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
vi /usr/lib/sasl2/smtpd.conf
pwcheck_method: authdaemond�D�D�D�D此处需要注意是否为authdaemond
log_level: 3
mech_list: PLAIN LOGIN
重新启动postfix:service postfix start
perl -e 'use MIME::Base64; print encode_base64("postmaster\@extmail.org")'
perl -e 'use MIME::Base64; print encode_base64("extmail")'
telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 mail.91ops.com ESMTP Postfix - by extmail.org
ehlo localhost
250-SIZE 5242880
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
telnet> quit
Connection closed.
chkconfig httpd on
chkconfig mysqld on
chkconfig postfix on
chkconfig courier-imap on
chkconfig courier-authlib on