我用的rhel5.5的操作系统
装系统的时候默认只装了基本和中文支持
LAMP+postfix+dovecot的部分略过
我所有的postfix包都在/media下,网站的路径是在/usr/local/apache2/下
mysql在/usr/local/mysql
cd /media/
tar -zxvf extman-0.2.5.tar.gz -C /usr/src
cd /usr/src/extman-0.2.5/docs/
mysql -u root -p < extmail.sql
mysql -u root -p < init.sql
vim /etc/postfix/main.cf
21 #mydestination = $mydomain, $myhostname
virtual_mailbox_base = /mailbox
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_uid_maps = static:1000
virtual_gid_maps = static:1000
cp mysql_virtual_* /etc/postfix
cd /media/
tar jxf courier-authlib-0.60.2.tar.bz2 -C /usr/src/
cd /usr/src/courier-authlib-0.60.2/
./configure --prefix=/usr/local/courier-authlib --without-stdheaderdir --with-authmysql --with-redhat --with-mysql-libs=/usr/local/mysql/lib/mysql --with-mysql-includes=/usr/local/mysql/include/mysql
make && make install
make install-configure
echo "/usr/local/courier-authlib/lib/courier-authlib" >> /etc/ld.so.conf
ldconfig
cd /usr/local/courier-authlib/etc/authlib
vim authdaemonrc
27 authmodulelist="authmysql"
34 authmodulelistorig="authmysql"
chmod -R 755 /usr/local/courier-authlib/var/spool/authdaemon
vim authmysqlrc
26 MYSQL_SERVER localhost //mysql数据库服务器位置
27 MYSQL_USERNAME extmail //管理员帐号
28 MYSQL_PASSWORD extmail //密码
49 MYSQL_SOCKET /tmp/mysql.sock
68 MYSQL_DATABASE extmail //虚拟用户数据库
83 MYSQL_USER_TABLE mailbox //从mailbox表获取邮件账户信息
92 MYSQL_CRYPT_PWFIELD password //从password获取密码
113 MYSQL_UID_FIELD uidnumber //从uidnumber字段映射本地uid
119 MYSQL_GID_FIELD gidnumber //从gidnumber字段映射本地gid
128 MYSQL_LOGIN_FIELD username
133 MYSQL_HOME_FIELD concat('/mailbox/',homedir)
139 MYSQL_NAME_FIELD name
150 MYSQL_MAILDIR_FIELD concat('/mailbox/',maildir)
cp /usr/src/courier-authlib-0.60.2/courier-authlib.sysvinit /etc/init.d/courier-authlib
chmod 755 /etc/init.d/courier-authlib
chkconfig courier-authlib on
service courier-authlib start
vim /usr/lib/sasl2/smtpd.conf
pwcheck_method:authdaemond
authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket
vim /etc/dovecot.conf
208#mail_location = maildir:~/Maildir (将此行#注释,改为下行)
mail_location = maildir:/mailbox/%d/%n/Maildir
auth default {
mechanisms = plain
829 passdb sql {
856 args = /etc/dovecot-mysql.conf
}
928 userdb sql {
934 args = /etc/dovecot-mysql.conf
}
vim /etc/dovecot-mysql.conf
driver = mysql
connect = host=localhost dbname=extmail user=extmail password=extmail
default_pass_scheme = CRYPT
password_query = SELECT username AS user,password AS password FROM mailbox WHERE username = '%u'
user_query = SELECT maildir,uidnumber AS uid,gidnumber AS gid FROM mailbox WHERE username = '%u'
mkdir -p /mailbox/extmail.org/postmaster/Maildir
chown -R postfix:postfix /mailbox
pkill dovecot
dovecot
测试:
/usr/local/courier-authlib/sbin/authtest -s login postmaster@extmail.org extmail
部署ExtMail邮件
tar -zxvf Unix-Syslog-1.1.tar.gz -C /usr/src
tar -zxvf DBI-1.607.tar.gz -C /usr/src
tar -zxvf DBD-mysql-4.011.tar.gz -C /usr/src
tar -zxvf extmail-1.0.5.tar.gz -C /usr/local/apache2/htdocs
cd /usr/src/Unix-Syslog-1.1
perl Makefile.PL
make
make install
cd ../DBI-1.607
perl Makefile.PL
make
make install
cd ../DBD-mysql-4.011
perl Makefile.PL --libs="-L/usr/local/mysql/lib/mysql -lmysqlclient -lz" --cflags=-I/usr/local/mysql/include/mysql
make
make install
cd /usr/local/apache2/htdocs
mv extmail-1.0.5/ extmail
cd extmail
chown -R postfix:postfix cgi
cp webmail.cf.default webmail.cf
vim webmail.cf
2 SYS_CONFIG = /usr/local/apache2/htdocs/extmail/
5 SYS_LANGDIR = /usr/local/apache2/htdocs/extmail/lang
8 SYS_TEMPLDIR = /usr/local/apache2/htdocs/extmail/html
112 SYS_MAILDIR_BASE = /mailbox
124 SYS_MYSQL_USER = extmail
125 SYS_MYSQL_PASS = extmail
126 SYS_MYSQL_DB = extmail
127 SYS_MYSQL_HOST = localhost
128 SYS_MYSQL_SOCKET = /tmp/mysql.sock
vim /usr/local/apache2/conf/httpd.conf
66 User postfix
67 Group postfix
390 Include conf/extra/httpd-vhosts.conf
vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/usr/local/apache2/htdocs/extmail/html"
ServerName mail.quantanetwork.com ScriptAlias /extmail/cgi/ /usr/local/apache2/htdocs/extmail/cgi/
Alias /extmail /usr/local/apache2/htdocs/extmail/html/
</VirtualHost>
/usr/local/apache2/bin/apachectl restart
部署Extman
cd /media
tar -zxvf GD-2.41.tar.gz -C /usr/src
tar –zxvf File-Tail-0.99.3.tar.gz -C /usr/src/
tar -zxvf extman-0.2.5.tar.gz -C /usr/local/apache2/htdocs/
cd /usr/src/GD-2.41
yum -y install gd-devel
perl Makefile.PL
make && make install
cd ../File-Tail-0.99.3
perl Makefile.PL
make && make install
rpm -ivh rrdtool-1.2.23-3.el5.i386.rpm
rpm -ivh rrdtool-perl-1.2.23-3.el5.i386.rpm
cd /usr/local/apache2/htdocs
mv extman-0.2.5 extman
chown -R postfix:postfix /usr/local/apache2/htdocs/extman/cgi
mkdir /tmp/extman
chown -R postfix:postfix /tmp/extman
vim /usr/local/apache2/htdocs/extman/webman.cf
2 SYS_CONFIG = /usr/local/apache2/htdocs/extman/
5 SYS_LANGDIR = /usr/local/apache2/htdocs/extman/lang
8 SYS_TEMPLDIR = /usr/local/apache2/htdocs/extman/html
12 SYS_MAILDIR_BASE = /mailbox
127 SYS_MYSQL_USER = webman
128 SYS_MYSQL_PASS = webman
129 SYS_MYSQL_DB = extmail
130 SYS_MYSQL_HOST = localhost
131 SYS_MYSQL_SOCKET = /tmp/mysql.sock
vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/usr/local/apache2/htdocs/extmail/html"
ServerName mail.quantanetwork.com
ScriptAlias /extmail/cgi/ /usr/local/apache2/htdocs/extmail/cgi/
Alias /extmail /usr/local/apache2/htdocs/extmail/html/
//新加入以下两行
ScriptAlias /extman/cgi/ /usr/local/apache2/htdocs/extman/cgi/
Alias /extman /usr/local/apache2/htdocs/extman/html/
</VirtualHost>
注意:
如果你网站服务器的网页跟extmail的网页在同一台机器的话
那么你就需要做虚拟主机,否则会默认访问到你的extmail
vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
在末尾添加如下几行 根据需求自己修改
<VirtualHost *:80>
DocumentRoot "/usr/local/apache2/htdocs/"
ServerName www.quantanetwork.com
Errorlog logs/www.quantanetwork.com.errerlog
CustomLog logs/www.quantanetwork.com.access.log common
</VirtualHost>
~
本文转自谢无赖51CTO博客,原文链接:http://blog.51cto.com/xieping/944930 ,如需转载请自行联系原作者