快速业务通道

rhel6.0 postfix mysql dovecot extmail sasl tls

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-03-28

rhel6.0 postfix mysql dovecot extmail Command History

0. disable SELinux -> setenforce 0

# yum -y install mysql mysql-server httpd telnet perl-CGI gcc perl-GD rrdtool-perl dovecot perl-Encode-Detect dovecot-mysql perl-ExtUtils-MakeMaker perl-Time-HiRes
# tar xf Unix-Syslog-1.1.tar.gz
# cd Unix-Syslog-1.1
# perl Makefile.PL
# make test
# make install

# tar xf File-Tail-0.99.3.tar.gz
# cd File-Tail-0.99.3
# perl Makefile.PL
# make test
# make install

# chkconfig mysqld dovecot httpd on
# chkconfig mysqld httpd on
# chkconfig mysqld dovecot on

# /etc/init.d/mysqld start
# /usr/bin/mysql_secure_installation

# mkdir /var/www/extsuite
# tar xf extmail-1.2.tar.gz -C /var/www/extsuite
# tar xf extman-1.1.tar.gz -C /var/www/extsuite
# cd /var/www/extsuite
# mv extmail-1.2/ extmail
# mv extman-1.1/ extman
# cd extman/docs
# cp extmail.sql linuxcbt.sql
# vi linuxcbt.sql
USE mysql;
INSERT INTO user (Host, User, Password) VALUES (''localhost'',''mailadmin'',password(''westos''));
INSERT INTO db (Host, Db, User, Select_priv, Insert_priv, Update_priv, Delete_priv) VALUES (''localhost'', ''maildb'', ''mailadmin'', ''Y'', ''Y'', ''Y'', ''Y'');
FLUSH PRIVILEGES;
GRANT USAGE ON maildb.* TO maildb@localhost

Empire CMS,phome.net
;
GRANT SELECT, UPDATE ON maildb.* TO maildb@localhost;
GRANT USAGE ON maildb.* TO mailadmin@localhost;
GRANT SELECT, INSERT, DELETE, UPDATE ON maildb.* TO mailadmin@localhost;
CREATE DATABASE maildb;
USE maildb;
...

# mysql -p < linuxcbt.sql
# cp init.sql init.linuxcbt.sql
# vi init.linuxcbt.sql
use maildb;
/*!40000 ALTER TABLE `alias` DISABLE KEYS */;
LOCK TABLES `alias` WRITE;
INSERT INTO `alias` VALUES (''support@linuxcbt.com'',''postmaster@linuxcbt.com'',''linuxcbt.com'',''2007-02-14 15:10:04'',1);
UNLOCK TABLES;
/*!40000 ALTER TABLE `alias` ENABLE KEYS */;
/*!40000 ALTER TABLE `domain` DISABLE KEYS */;
LOCK TABLES `domain` WRITE;
INSERT INTO `domain` VALUES (''linuxcbt.com'',''virtualDomain for linuxcbt.com'',''A0/B0'',50,50,1073741824,1073741824,NULL,''1'',''5242880'',''5242880'',''1y'',''0'',''0'',''0'',''0'',''1'',''0'',''2007-02-14 15:10:04'',''2010-11-08'',1);
UNLOCK TABLES;
/*!40000 ALTER TABLE `domain` ENABLE KEYS */;
/*!40000 ALTER TABLE `mailbox` DISABLE KEYS */;
/* postmaster@linuxcbt.com password is westos */
LOCK TABLES `mailbox` WRITE;
INSERT INTO `mailbox` VALUES (''postmaster@linuxcbt.com
Empire CMS,phome.net
'',''postmaster'',''westos'','''',''PostMaster'','''',''linuxcbt.com/postmaster/Maildir/'',''linuxcbt.com/postmaster'',''104857600S'',''52428800S'',''linuxcbt.com'',1000,1000,''2007-02-14 15:10:04'',''2010-11-08'',1,0,0,0,0,0,0,0,''my question'',''my answer'');
UNLOCK TABLES;
/*!40000 ALTER TABLE `mailbox` ENABLE KEYS */;

/*!40000 ALTER TABLE `manager` DISABLE KEYS */;
/* root@linuxcbt.com password is westos */
LOCK TABLES `manager` WRITE;
INSERT INTO `manager` VALUES (''root@linuxcbt.com'',''westos'',''admin'',''root'',''Super User'',''my question'',''my answer'',''0'',''2007-02-14 15:10:04'',''2010-11-08'',1);
UNLOCK TABLES;
/*!40000 ALTER TABLE `manager` ENABLE KEYS */;

# mysql -p < init.linuxcbt.sql
# cp mysql_virtual_* /etc/postfix/
# cd /etc/postfix/
# rm -rf mysql_virtual_limit_maps.cf
# rm -rf mysql_virtual_sender_maps.cf
# vi mysql_virtual_alias_maps.cf
user = mailadmin
password = westos

hosts = localhost
dbname = maildb
table = alias
select_field = goto
where_field = address
additional_conditions = AND active = ''1''

# vi mysql_virtual_domains_maps.cf
user = mailadmin
password = westos

hosts = localhost
dbname = maildb
table = domain
select_field = domain
where_field = domain
additional_conditions = AND active = ''1''

# vi mysql_virtual_mailbox_maps.cf
Empire CMS,phome.net
user = mailadmin
password = westos

hosts = localhost
dbname = maildb
table = mailbox
select_field = maildir
where_field = username
additional_conditions = AND active = ''1''

# postmap -q "support@linuxcbt.com" mysql:/etc/postfix/mysql_virtual_alias_maps.cf
postmaster@linuxcbt.com

# postmap -q "postmaster@linuxcbt.com" mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
linuxcbt.com/postmaster/Maildir/

# postmap -q "linuxcbt.com" mysql:/etc/postfix/mysql_virtual_domains_maps.cf
linuxcbt.com

# useradd -u 600 -s /sbin/nologin email
# postconf -d | grep virtual
# postconf -e virtual_mailbox_base=/home/email
# postconf -e virtual_uid_maps=static:600
# postconf -e virtual_gid_maps=static:600
# postconf -e virtual_alias_maps=mysql:/etc/postfix/mysql_virtual_alias_maps.cf
# postconf -e virtual_mailbox_domains=mysql:/etc/postfix/mysql_virtual_domains_maps.cf
# postconf -e virtual_mailbox_maps=mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
# postconf -e inet_interface=all
# /etc/init.d/postfix restart

# cd /etc/dovecot/conf.d/
# vi 10-mail.conf
mail_location = maildir:/home/email/%d/%n/Maildir

# cp /etc/dovecot/conf.d/auth-sql.conf.ext /etc/dovecot/conf.d/auth-sql.conf
# cd /etc/dovecot/
# cp /usr/share/doc/dovecot-2.0/example-config/dovecot-sql.conf.ext .
# vi dovecot-sql.conf.ext
driver = mysql
connect = host=localhost dbname=maildb user=mailadmin password=westos
default_pass_scheme = PLAIN
Empire CMS,phome.net

password_query = \
SELECT username, domain, password \
FROM mailbox WHERE username = ''%u''
user_query = \
SELECT maildir, 600 AS uid, 600 AS gid \
FROM mailbox WHERE username = ''%u''

# /etc/init.d/dovecot restart
# telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.
Escape character is ''^]''.
OK Dovecot ready. <6678.1.4e744cf8.BJiCC1ak86Rl1d8fHNUAPQ==@desktop17.example.com>
user postmaster@linuxcbt.com
OK
pass westos
OK Logged in.
list
OK 1 messages:
1 573


# vim /etc/httpd/conf/httpd.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName server17.example.com
</VirtualHost>
<VirtualHost *:80>
ServerName mail.linuxcbt.com
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
SuexecUserGroup email email
</VirtualHost>

# cd /var/www/extsuite/extmail/
# chown -R email.email cgi/
# cp webmail.cf.default webmail.cf
# vi webmail.cf
SYS_MAILDIR_BASE = /home/email
SYS_CRYPT_TYPE = plain
SYS_MYSQL_USER = mailadmin
SYS_MYSQL_PASS = westos
SYS_MYSQL_DB = maildb

# cd /var/www/extsuite/extman/
# cp webman.cf.default webman.cf
# chown -R email.email cgi/
# vi webmail.cf
SYS_MAILDIR_BASE = /home/email
Empire CMS,phome.net

SYS_SESS_DIR = /tmp/
SYS_GROUPMAIL_SENDER = postmaster@linuxcbt.com
SYS_CRYPT_TYPE = plain
SYS_MYSQL_USER = mailadmin
SYS_MYSQL_PASS = westos
SYS_MYSQL_DB = maildb

# cd /var/www/extsuite/extman/addon
# cp -r mailgraph_ext/ /usr/local/
# /usr/local/mailgraph_ext/mailgraph-init start

# vi /etc/hosts
192.168.0.248 mail.linuxcbt.com

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号