Postfix邮件服务器搭建
第一部分、系统准备
#========================关闭SELinux===================
setenforce 0
cp /opt/config/selinux-config /etc/selinux/config
#=====================删除sendmail=====================
rpm -e --nodeps sendmail
groupadd -g 2525 postfix
useradd -g postfix -u 2525 -s /sbin/nologin -M postfix
groupadd -g 2526 postdrop
useradd -g postdrop -u 2526 -s /bin/false -M postdrop
groupadd -g 1000 vgroup
useradd -g 1000 -u 1000 -M -s /bin/false vuser
yum install ncurses-devel gdbm-devel gcc* perl-DBI openssl-devel flex libxml2-devel libpng-devel db4-devel* pcre-devel gd-devel libc-client-devel cairo* pango-devel
第二部分、 LAMP 站点服务搭建
(
1
)安装
ncurses-5.6================================================
cd /opt
tar zxvf ncurses-5.6.tar.gz
cd ncurses-5.6
./configure --prefix=/usr --with-shared --without-debug
make
make install
(
2
)安装
mysql======================================================
cd /opt
groupadd mysql
useradd mysql -g mysql -s /sbin/nologin
tar -zxvf mysql-5.0.70.tar.gz
cd mysql-5.0.70
./configure --with-mysqld-user=mysql --prefix=/usr/local/webserver/mysql5 --with-charset=gbk --with-extra-charset=all --without-isam --exec-prefix=/usr/local/webserver/mysql5 --with-unix-socket-path=/usr/local/webserver/mysql5/var/mysql.sock
make;make install
/usr/local/webserver/mysql5/bin/mysql_install_db
cp /usr/local/webserver/mysql5/share/mysql/my-medium.cnf /usr/local/webserver/mysql5/var/my.cnf
cp /usr/local/webserver/mysql5/share/mysql/mysql.server /etc/init.d/mysqld
chmod 700 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 2345 mysqld on
chown mysql:mysql -R /usr/local/webserver/mysql5/
vi /usr/local/webserver/mysql5/var/my.cnf
添加
max_connections=1000
service mysqld start
ln -s /usr/local/webserver/mysql5/bin/mysql_config /usr/bin/mysql_config
ln -s /usr/local/webserver/mysql5/bin/mysql /sbin/mysql
ln -s /usr/local/webserver/mysql5/bin/mysqladmin /sbin/mysqladmin
#配置库文件搜索路径
echo "/usr/local/webserver/mysql5/lib/mysql" >> /etc/ld.so.conf
ldconfig -v
#添加/usr/local/mysql/bin到环境变量PATH中
export PATH=$PATH:/usr/local/webserver/mysql5/bin
(
3
)
Courier authentication library================
tar -jxvf courier-authlib-0.63.0.tar.bz2
cd courier-authlib-0.63.0
./configure --prefix=/usr/local/webserver/courier-authlib --without-stdheaderdir --sysconfdir=/etc --without-authuserdb --without-authpam --without-authldap --without-authpwd --without-authshadow --without-authvchkpw --without-authpgsql --with-authcustom --with-authmysql --with-mysql-libs=/usr/local/webserver/mysql5/lib/mysql --with-mysql-includes=/usr/local/webserver/mysql5/include/mysql --with-redhat --with-mailuser=vuser --with-mailgroup=vgroup --with-authmysqlrc=/etc/authmysqlrc --with-authdaemonrc=/etc/authdaemonrc CFLAGS="-march=i686 -O2 -fexpensive-optimizations" CXXFLAGS="-march=i686 -O2 -fexpensive-optimizations"
make;make install
make install-migrate
make install-configure
echo "/usr/local/webserver/courier-authlib/lib/courier-authlib">>/etc/ld.so.conf
ldconfig -v
如果无法发送邮件的解决办法
问题:.warning: SASL authentication failure: cannot connect to Courier authdaemond: Permission denied
增加"/usr/local/webserver/courier-authlib/lib/courier-authlib"到你的"/etc/ld.so.conf",并执行ldconfig命令。
chmod +x /usr/local/webserver/courier-authlib/var/spool/authdaemon
chmod 755 /usr/local/webserver/courier-authlib/var/spool/authdaemon
#编辑配置文件
ln -s /usr/local/webserver/courier-authlib/bin/courierauthconfig /usr/bin/courierauthconfig
ln -svf /usr/local/webserver/courier-authlib/include/* /usr/include/
cp ./courier-authlib.sysvinit /etc/init.d/courier-authlib
chmod 755 /etc/init.d/courier-authlib
chkconfig --add courier-authlib
chkconfig --level 2345 courier-authlib on
#启动服务
service courier-authlib start
修改/etc/authdaemonrc 文件
authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=10
DEBUG_LOGIN=2
编辑/etc/authmysqlrc 为以下内容,其中1000,1000为vuser用户的UID和vgroup的GID。
MYSQL_SERVER localhost
MYSQL_PORT 3306
(指定你的mysql监听的端口,这里使用默认的3306)
MYSQL_USERNAME extmail
(这时为后文要用的数据库的所有者的用户名)
MYSQL_PASSWORD extmail
(密码)
MYSQL_SOCKET /usr/local/webserver/mysql5/var/mysql.sock (思考:/usr/local/mysql/var/mysql.sock)
MYSQL_DATABASE extmail
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD '1000'
MYSQL_GID_FIELD '1000'
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD concat('/var/mailbox/',homedir)
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD concat('/var/mailbox/',maildir)
MYSQL_QUOTA_FIELD quota
(
4
)安装安装
sasl-2.1.22==========================================
tar zxvf cyrus-sasl-2.1.23.tar.gz
cd cyrus-sasl-2.1.23
#./configure --prefix=/usr/local/webserver/sasl2 --disable-gssapi --disable-anon --disable-sample --disable-digest --enable-plain --enable-login --enable-sql --with-mysql=/usr/local/webserver/mysql5 -with-mysql-includes=/usr/local/webserver/mysql5/include/mysql --with-mysql-libs=/usr/local/webserver/mysql5/lib/mysql --with-authdaemond=/usr/local/webserver/courier-authlib/var/spool/authdaemon/socket
cp mac/libdes/public/des.h ./
make
make install
关闭原有的sasl,并创建链接(这个地方我和原文有不同)postfix 2.3以后的版本会分别在/usr/local/lib和/usr/local/include中搜索sasl库文件及头文件,故还须将其链接至此目录中:
mv /usr/lib/sasl2 /usr/lib/sasl2.save
mv /usr/lib/libsasl2.so.2 /usr/lib/libsasl2.so.2.save
mv /usr/lib/libsasl2.so.2.0.22 /usr/lib/libsasl2.so.2.0.22.save
ln -sv /usr/local/webserver/sasl2/lib/* /usr/lib
ln -sv /usr/local/webserver/sasl2/lib/* /usr/local/lib
ln -sv /usr/local/webserver/sasl2/include/sasl/* /usr/local/include
创建运行时需要的目录并调试启动
mkdir -pv /var/state/saslauthd
/usr/local/webserver/sasl2/sbin/saslauthd -a shadow pam -d
启动并测试
/usr/local/webserver/sasl2/sbin/saslauthd -a shadow pam
配置库文件搜索路径
echo "/usr/local/webserver/sasl2/lib" >> /etc/ld.so.conf
echo "/usr/local/webserver/sasl2/lib/sasl2" >> /etc/ld.so.conf
ldconfig -v
echo "/usr/local/webserver/sasl2/sbin/saslauthd -a shadow pam" >> /etc/rc.local
接下来配置SMTP 认证,编辑 /usr/local/lib/sasl2/smtpd.conf,确保其为以下内容:
pwcheck_method: authdaemond
log_level: 3
mech_list:PLAIN LOGIN
authdaemond_path:/usr/local/webserver/courier-authlib/var/spool/authdaemon/socket
(
5
)安装
httpd-2.2.8===========================================
tar jxvf httpd-2.2.6.tar.bz2
cd httpd-2.2.6
./configure --prefix=/usr/local/webserver/httpd --enable-so --enable-ssl --with-ssl --enable-track-vars --enable-rewrite --with-zlib --enable-mods-shared=most --enable-suexec --with-suexec-caller=daemon --with-suexec-docroot=/var/www --enable-proxy
make;make install
#apache 开机启动
/usr/local/webserver/httpd/bin/apachectl start
echo "/usr/local/webserver/httpd/bin/apachectl start" >> /etc/rc.local
(
6
)安装
libPNG==============================================
tar zxvf /mnt/libpng*
cd libpng
./configure --prefix /usr/local/webserver/libpng
make;make install
ln -svf /usr/local/webserver/libpng/lib/pkgconfig/* /usr/lib/pkgconfig/
ln -svf /usr/local/webserver/libpng/lib/* /usr/lib
ln -svf /usr/local/webserver/libpng/lib/* /usr/local/lib
ln -svf /usr/local/webserver/libpng/include/libpng12/* /usr/include/libpng12/
ln -svf /usr/local/webserver/libpng/include/* /usr/include/
ln -svf /usr/local/webserver/libpng/include/* /usr/local/include/
echo "/usr/local/webserver/libpng/lib">>/etc/ld.so.conf
ldconfig –v
(9)安装freetype==========================================
tar zxvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local/webserver/freetype
make;make install
ln -vsf /usr/local/webserver/freetype/lib/* /usr/lib
ln -svf /usr/local/webserver/freetype/lib/pkgconfig/* /usr/lib/pkgconfig/
ln -vsf /usr/local/webserver/freetype/lib/* /usr/local/lib
ln -vsf /usr/local/webserver/freetype/include/freetype2/* /usr/include/
ln -vsf /usr/local/webserver/freetype/include/freetype2/* /usr/local/include/
echo "/usr/local/webserver/freetype/lib" >> /etc/ld.so.conf
ldconfig -v
(
7
)安装
JPEG6============================================
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
mkdir -pv /usr/local/webserver/jpeg/{,bin,lib,include,man/man1,man1}
./configure --prefix=/usr/local/webserver/jpeg --enable-shared --enable-static
make;make install
ln -svf /usr/local/webserver/jpeg/lib/* /usr/local/lib
ln -svf /usr/local/webserver/jpeg/lib/* /usr/lib
ln -svf /usr/local/webserver/jpeg/include/* /usr/local/include/
ln -svf /usr/local/webserver/jpeg/include/* /usr/include/
echo "/usr/local/webserver/jpeg/lib" >> /etc/ld.so.conf
ldconfig -v
(
8
)安装
GD==============================================
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --prefix=/usr --with-png --with-freetype=/usr/local/webserver/freetype --with-jpeg=/usr/local/webserver/jpeg/
make;make install
(
9
)安装
LIBXML2========================================#
tar zxvf libxml2-2.6.31.tar.gz
cd libxml2-2.6.31
./configure --prefix=/usr/local/webserver/libxml2
make;make install
cp xml2-config /usr/bin
ln -svf /usr/local/webserver/libxml2/include/* /usr/local/include/
ln -svf /usr/local/webserver/libxml2/include/* /usr/include/
ln -svf /usr/local/webserver/libxml2/lib/pkgconfig/* /usr/lib/pkgconfig/
ln -svf /usr/local/webserver/libxml2/lib/* /usr/lib
ln -svf /usr/local/webserver/libxml2/lib/* /usr/local/lib
echo "/usr/local/webserver/libxml2/lib">>/etc/ld.so.conf
ldconfig -v
(
10
)安装
libmcrypt=====================================
tar zxvf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure --prefix=/usr/local/webserver/libmcrypt
make;make install
ln -sv /usr/local/webserver/libmcrypt/include/* /usr/local/include/
ln -sv /usr/local/webserver/libmcrypt/include/* /usr/include/
ln -sv /usr/local/webserver/libmcrypt/lib/* /usr/local/lib
ln -sv /usr/local/webserver/libmcrypt/lib/* /usr/lib
echo " /usr/local/webserver/libmcrypt/lib" >> /etc/ld.so.conf
ldconfig –v
(
11
)安装
Courier-IMAP====================================
tar jxvf courier-imap-4.8.0.20100628.tar.bz2
cd courier-imap-4.8.0.20100628
./configure --prefix=/usr/local/webserver/courier-imap --with-redhat --enable-unicode --disable-root-check --with-trashquota --without-ipv6 CPPFLAGS=' -I/usr/local/webserver/courier-authlib/include' LDFLAGS='-L/usr/local/webserver/courier-authlib/lib/courier-authlib' COURIERAUTHCONFIG='/usr/local/webserver/courier-authlib/bin/courierauthconfig'
make
make install
#编辑配置文件
cp /usr/local/webserver/courier-imap/etc/imapd.dist /usr/local/webserver/courier-imap/etc/imapd
cp /usr/local/webserver/courier-imap/etc/imapd-ssl.dist /usr/local/webserver/courier-imap/etc/imapd-ssl
cp /usr/local/webserver/courier-imap/etc/pop3d.dist /usr/local/webserver/courier-imap/etc/pop3d
cp /usr/local/webserver/courier-imap/etc/pop3d-ssl.dist /usr/local/webserver/courier-imap/etc/pop3d-ssl
cp ./courier-imap.sysvinit /etc/init.d/courier-imapd
chmod 755 /etc/rc.d/init.d/courier-imapd
chkconfig --add courier-imapd
chkconfig --level 2345 courier-imapd on
#修改/usr/local/lib/sasl2/smtpd.conf文件,配置SMTP 认证
pwcheck_method: authdaemond
log_level: 3
mech_list:PLAIN LOGIN
authdaemond_path:/usr/local/webserver/courier-authlib/var/spool/authdaemon/socket
#启动courier-imapd
service courier-imapd start
(
12
)安装
PHP5.2.5=====================================
tar zxvf php-5.2.4.tar.gz
cd php-5.2.4
./configure --prefix=/usr/local/webserver/php5 --with-mysql=/usr/local/webserver/mysql5 --with-apxs2=/usr/local/webserver/httpd/bin/apxs --with-jpeg-dir=/usr/local/webserver/jpeg --with-freetype-dir=/usr/local/webserver/freetype --with-zlib --with-gd --enable-ftp --enable-sockets -enable-mbstring=all --with-mcrypt=/usr/local/webserver/libmcrypt --with-mysqli=/usr/local/webserver/mysql5/bin/mysql_config --with-imap --with-kerberos --with-imap-ssl
make;make install
cp php.ini-dist /usr/local/webserver/php5/lib/php.ini
# vi httpd.conf
1、添加如下二行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
2、定位至DirectoryIndex index.html
修改为:
DirectoryIndex index.php index.html
killall httpd
/usr/local/apache2/bin/apachectl start
第三部分、
postfix
安装及配置
(
1
)安装
/postfix-2.8-20100213.tar.gz================================
tar zxvf postfix-2.8-20100213.tar.gz
cd /postfix-2.8-20100213
make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/webserver/mysql5/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/local/webserver/sasl2/include/sasl' 'AUXLIBS=-L/usr/local/webserver/mysql5/lib/mysql -lmysqlclient -lz -lm -L/usr/local/webserver/sasl2/lib -lsasl2 -L/usr/local/ssl/lib -lssl -lcrypto'
make;make install
#生成别名二进制文件,这个步骤如果忽略,会造成postfix效率极低:
newaliases
#生成的aliases.db默认是在/etc/目录下,须做软连接,后面的lias_maps配置会用到
ln -s /etc/aliases.db /etc/postfix/aliases.db
#编辑配置文件
#vi /etc/postfix/main.cf
修改以下几项为您需要的配置
myhostname = mail.lxh.com
myorigin = lxh.com
mydomain = lxh.com
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks = 192.168.1.0/24, 127.0.0.0/8
vi /etc/postfix/main.cf
在文件末尾添加以下内容:
############################CYRUS-SASL############################
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject_invalid_hostname,reject_non_fqdn_hostname,reject_unknown_sender_domain,reject_non_fqdn_sender,reject_non_fqdn_recipient,reject_unknown_recipient_domain,reject_unauth_pipelining,reject_unauth_destination permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_sasl_application_name = smtpd
smtpd_banner = Welcome to our $myhostname ESMTP,Warning: Version not Available!
让
postfix
支持虚拟域和虚拟用户
A
.编辑
/etc/postfix/main.cf
,在文件末尾添加如下内容:
########################Virtual Mailbox Settings########################
virtual_mailbox_base = /var/mailbox
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_alias_domains =
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_uid_maps = static:1000
virtual_gid_maps = static:1000
virtual_transport = maildrop
maildrop_destination_recipient_limit = 1
maildrop_destination_concurrency_limit = 1
##########################QUOTA Settings########################
message_size_limit = 14336000
virtual_mailbox_limit = 20971520
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please Tidy your mailbox and try again later.
virtual_overquota_bounce = yes
B
.添加为支持虚拟域和虚拟用户所用到的配置文件
编辑/etc/postfix/mysql_virtual_alias_maps.cf ,添加如下内容:
user = extmail
password = extmail
hosts = 127.0.0.1
dbname = extmail
table = alias
select_field = goto
where_field = address
编辑/etc/postfix/mysql_virtual_domains_maps.cf ,添加如下内容:
user = extmail
password = extmail
hosts = 127.0.0.1
dbname = extmail
table = domain
select_field = description
where_field = domain
编辑/etc/postfix/mysql_virtual_mailbox_limit_maps.cf ,添加如下内容:
user = extmail
password = extmail
hosts =127.0.0.1
dbname = extmail
table = mailbox
select_field = quota
where_field = username
编辑/etc/postfix/mysql_virtual_mailbox_maps.cf ,添加如下内容:
user = extmail
password = extmail
hosts = 127.0.0.1
dbname = extmail
table = mailbox
select_field = maildir
where_field = username
C
.说明:
1、这里用到的数据库及用户的建立可以后文中的extmail说明部分来实现,您可以参照那一部分来理解这里指定的数据库及其用户名等;
2、以上新建文件亦可以从extman安装文件中获得,您也可以由此不用手动输入;
3、虚拟用户邮箱目录我这里沿用了/var/mailbox,你可以指定为别的目录,比如常见到的/var/spool/mail,或者/home/domains等;但如果这里做了修改,请在后文中用到时作了相应的修改;
#启动postfix
mkdir –pv /var/mailbox
chown -R vuser.vgroup /var/mailbox
echo "/usr/sbin/postfix start">>/etc/rc.local
(2)
安装
pcre==============================================
tar jxvf /mnt/pcre-7.3.tar.bz2
rpm -e --nodeps pcre-*
cd pcre-7.3
./configure
make
make install
(
3
)安装
courier-maildrop================================
tar jxvf /mnt/maildrop-2.5.0.20100628.tar.bz2
cd maildrop-2.5.0.20100628
./configure --enable-sendmail=/usr/sbin/sendmail --enable-trusted-users='root vuser' --enable-syslog=1 --enable-maildirquota --enable-maildrop-uid=1000 --enable-maildrop-gid=1000 --with-trashquota --with-dirsync
make
make install
A.检查安装结果,请确保有"Courier Authentication Library extension enabled."一句出现:
# maildrop -v
maildrop 2.0.2 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.
B.新建其配置文件/etc/maildroprc文件,首先指定maildrop的日志记录位置:
# vi /etc/maildroprc
添加如下内容:
logfile "/var/log/maildrop.log"
to "$HOME/Maildir"
建立日志文件
touch /var/log/maildrop.log
chown vuser.vgroup /var/log/maildrop.log
C.配置Postfix
编辑master.cf
# vi /etc/postfix/master.cf
启用如下两行
maildrop unix -
n n - - pipe
flags=DRhu user=vuser argv=/usr/local/bin/maildrop -d ${recipient}
注意:定义transport的时候,即如上两行中的第二行,其参数行必须以空格开头,否则会出错。
(
4)Webmail
安装配置========================================
tar -zxvf extmail-1.2.tar.gz
mkdir -pv /var/www/extsuite
mv extmail-1.2 /var/www/extsuite/extmail
cp /var/www/extsuite/extmail/webmail.cf.default /var/www/extsuite/extmail/webmail.cf
vi /var/www/extsuite/extmail/webmail.cf
部分修改选项的说明:
SYS_MESSAGE_SIZE_LIMIT = 5242880
用户可以发送的最大邮件
SYS_USER_LANG = en_US
语言选项,可改作:
SYS_USER_LANG = zh_CN
SYS_MAILDIR_BASE = /home/domains
此处即为您在前文所设置的用户邮件的存放目录,可改作:
SYS_MAILDIR_BASE = /var/mailbox
SYS_MYSQL_USER = db_user
SYS_MYSQL_PASS = db_pass
以上两句句用来设置连接数据库服务器所使用用户名、密码和邮件服务器用到的数据库,这里修改为:
SYS_MYSQL_USER = extmail
SYS_MYSQL_PASS = extmail
SYS_MYSQL_HOST = localhost
指明数据库服务器主机名,这里默认即可
SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock
连接数据库的sock文件位置,这里修改为:
SYS_MYSQL_SOCKET = /usr/local/webserver/mysql5/var/mysql.sock
SYS_MYSQL_HOST = 127.0.0.1
SYS_MYSQL_TABLE = mailbox
SYS_MYSQL_ATTR_USERNAME = username
SYS_MYSQL_ATTR_DOMAIN = domain
SYS_MYSQL_ATTR_PASSWD = password
以上用来指定验正用户登录里所用到的表,以及用户名、域名和用户密码分别对应的表中列的名称;这里默认即可
SYS_AUTHLIB_SOCKET = /var/spool/authdaemon/socket
此句用来指明authdaemo socket文件的位置,这里修改为:
SYS_AUTHLIB_SOCKET = /usr/local/webserver/courier-authlib/var/spool/authdaemon/socket
chown -R vuser.vgroup /var/www/extsuite/extmail/cgi/
apache相关配置
由于extmail要进行本地邮件的投递操作,故必须将运行apache服务器用户的身份修改为您的邮件投递代理的用户;本例中打开了apache服务器的suexec功能,故使用以下方法来实现虚拟主机运行身份的指定。此例中的MDA为postfix自带,因此将指定为postfix用户:
<VirtualHost *:80>
ServerName mail.lxh.com
DocumentRoot /var/www/extsuite/extmail/html/
ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi
Alias /extmail /var/www/extsuite/extmail/html
SuexecUserGroup vuser vgroup
</VirtualHost>
(5)
安装
Extman=============================================
tar zxvf extman-1.0.0.tar.gz
mv extman-1.0.0 /var/www/extsuite/extman
修改配置文件以符合本例的需要:
vi /var/www/extsuite/extman/webman.cf
SYS_MAILDIR_BASE = /home/domains
此处即为您在前文所设置的用户邮件的存放目录,可改作:
SYS_MAILDIR_BASE = /var/mailbox
SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock
此处修改为:
SYS_MYSQL_SOCKET = /usr/local/webserver/mysql5/var/mysql.sock
SYS_CAPTCHA_ON = 1 此处为0登陆后台要不要显示验证码,1为需要。
SYS_CHARSET = gb2312
SYS_MYSQL_HOST = 127.0.0.1
SYS_LANG = zh_CN
使用extman源码目录下docs目录中的extmail.sql和init.sql建立数据库:
cd /var/www/extsuite/extman/docs
mysql -u root -p <extmail.sql
mysql -u root -p <init.sql
cd /var/www/extsuite/extman/libs/Ext
./buildpkg.sh build /var/www/extsuite/extmail/libs/Ext
mkdir /tmp/extman
chown -R vuser:vgroup /tmp/extman
cd /var/www/extsuite/extman/tools/
./maildirmake.pl /var/mailbox/extmail.org/postmaster/Maildir
chown -R vuser:vgroup /var/mailbox/
修改cgi目录的属主:
# chown -R vuser.vgroup /var/www/extsuite/extman/cgi/
如果extman访问数据库权限不足的话,可采用以下命令将新生成的数据库赋予webman用户具有所有权限:
mysql> GRANT all privileges on extmail.* TO webman@localhost IDENTIFIED BY 'webman';
mysql> GRANT all privileges on extmail.* TO webman@127.0.0.1 IDENTIFIED BY 'webman';
在apache的主配置文件中Extmail的虚拟主机部分,添加如下两行:
ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi
Alias /extman /var/www/extsuite/extman/html
创建其运行时所需的临时目录,并修改其相应的权限:
mkdir -pv /tmp/extman
chown vuser.vgroup /tmp/extman
(
6
)安装
extman
依赖关系包
A.tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --with-png -with-freetype --with-jpeg --with-zlib --with-fontconfig
make
make install
B.安装GD
tar zxvf GD-2.44.tar.gz
cd GD-2.44
perl Makefile.PL
make
make install
C.安装Unix::Syslog
tar zxvf /mnt/Unix-Syslog-1.1.tar.gz
cd Unix-Syslog-1.1.tar.gz
perl Makefile.PL
make
make install
D.安装DBD-mysql-4.014
tar zxvf DBD-mysql-4.014
cd DBD-mysql-4.014
perl Makefile.PL
make
make install
好了,到此为止,重新启动apache服务器后,您的Webmail和Extman已经可以使用了,可以在浏览器中输入指定的虚拟主机的名称进行访问,如下:
http://mail.lxh.com/选择管理即可登入extman进行后台管理了。默认管理帐号为:root@extmail.org 密码为:extmail*123*
(
7
)安装
rrdtool-1.2.23
ln -sv /usr/local/webserver/libxml2/lib/* /usr/lib/
ln -sv /usr/local/webserver/libxml2/lib/* /usr/local/lib/
ln -sv /usr/local/webserver/libxml2/include/* /usr/include/
perl -MCPAN -e shell
install File::Tail
tar zxvf rrdtool-1.2.23.tar.tar
cd rrdtool-1.2.23
./configure --prefix=/usr/local/webserver/rrdtool
make
make install
#创建必要的符号链接(Extman会到这些路径下找相关的库文件)
ln -sv /usr/local/webserver/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/auto/RRDs/RRDs.so /usr/lib/perl5/5.8.8//i386-linux-thread-multi/
ln -sv /usr/local/webserver/rrdtool/lib/perl/5.8.8/RRDp.pm /usr/lib/perl5/5.8.8/
ln -sv /usr/local/webserver/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/RRDs.pm /usr/lib/perl5/5.8.8/
cp -r /usr/local/webserver/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/* /usr/lib/perl5/5.8.8/i386-linux-thread-multi/
复制mailgraph_ext到/usr/local,并启动之
cp -r /var/www/extsuite/extman/addon/mailgraph_ext /usr/local
/usr/local/mailgraph_ext/mailgraph-init start
/usr/local/mailgraph_ext/qmonitor-init start
#添加到自动启动队列
echo "/usr/local/mailgraph_ext/mailgraph-init start" >> /etc/rc.local
echo "/usr/local/mailgraph_ext/qmonitor-init start" >> /etc/rc.local
测试:http:// 你的服务器ip/ 访问mail前台页面
http://你的服务器ip/extman 访问mail的后台管理
========================= =完成= ==================================
转载于:https://blog.51cto.com/284646/435383