postfix全功能邮件服务器配置
1.postfix所需软件包及存放目录
httpd-2.2.9.tar.gz
安装源码包
apache
mysql-5.0.56.tar.gz
安装源码包
mysql
php-5.2.6.tar.bz2
安装
php软件
postfix-2.6.2.tar.gz
postfix主程序
postfix-2.6.2-vda-ng.patch.gz
postfix的补丁包
dovecot-1.1.4.tar.gz
IMAP和
POP3邮件服务器软件
squirrelmail-1.4.13.tar.bz2
web界面邮件管理
zh_CN-1.4.13-20071220.tar.bz2
汉化包
extman-0.2.5.tar.gz
邮件后台管理程序
extmail-1.0.5.tar.gz
web界面邮件管理
courier-authlib-0.62.4.tar.bz2
SMTP发信认证
Unix-Syslog-1.1.tar.gz
DBI-1.616.tar.gz
DBD-mysql-4.020.tar.gz
以上三个包为
extmail的倚赖包
GD-2.46.tar.gz
File-Tail-0.99.3.tar.gz
rrdtool-1.2.23-3.el5.i386.rpm
rrdtool-perl-1.2.23-3.el5.i386.rpm
以上四个包为
extman的倚赖包
fp-Linux-i686-ws.tar.gz
MailScanner-4.84.3-1.rpm.tar.gz
Mail-SpamAssassin-3.3.2.tar.gz
你可以把这些软件包放在同一个目录下,这样方便查找安装,本实验我把这些软件包放在了root的家目录下
一、基本的配置:
1.1
首先配置网络参数:
[root@email ~]# cat /etc/sysconfig/networking/devices/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0c:29:e9:57:8c
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=14.14.14.4
TYPE=Ethernet
GATEWAY=14.14.14.254
1.2
指定
dns
地址:
[root@email ~]# cat /etc/resolv.conf
search localdomain
nameserver 14.14.14.4
1.3
首先配置
DNS
服务:
[root@email ~]# yum install -y bind bind-chroot caching-nameserver
[root@email ~]# cd /var/named/chroot/etc/
[root@email etc]# ll
total 32
-rw-r--r-- 1 root root
405 Mar 20 23:05 localtime
-rw-r----- 1 root named 1230 Jul 30 2009 named.caching-nameserver.conf
-rw-r----- 1 root named 955 Jul 30 2009 named.rfc1912.zones
-rw-r----- 1 root named 113 Mar 21 00:21 rndc.key
[root@email etc]# cp -p named.caching-nameserver.conf named.conf
[root@email etc]# vim named.conf
15
listen-on port 53 { any; };
27
allow-query { any; };
28
allow-query-cache { any; };
37
match-clients { any; };
38
match-destinations { any; };
[root@email etc]# vim named.rfc1912.zones
21 zone "postfix.email" IN {
22
type master;
23
file "postfix.email.db";
24
allow-update { none; };
25 };
39 zone "14.14.14.in-addr.arpa" IN {
40
type master;
41
file "14.14.14.db";
42
allow-update { none; };
43 };
[root@email etc]# cd ../var/named/
[root@email named]# cp -p localhost.zone postfix.email.db
[root@email named]# im postfix.email.db
2 @
IN SOA ns.gxy.com. root (
9 @
IN NS ns.gxy.com.
10 mail
IN A 14.14.14.4
11 www
IN A 14.14.14.3
12 pop3
IN A mail
13 @
IN MX 10 mail
[root@email named]# cp -p named.local 14.14.14.db
[root@email named]# vim 14.14.14.db
10 4
IN PTR mail.postfix.email.
[root@email named]# chkconfig named on
[root@email named]# service named start
Starting named:
[ OK ]
1.4
检测是否解析:
[root@email named]# nslookup mail.gxy.com
Server:
14.14.14.4
Address: 14.14.14.4#53
Name:
mail.gxy.com
Address: 14.14.14.4
[root@email named]# nslookup 14.14.14.4
Server:
14.14.14.4
Address: 14.14.14.4#53
4.14.14.14.in-addr.arpa name = mail.gxy.xom.
二、构建相应的服务器:
2.1
开始构建
postfix
全功能邮件服务器:
[root@email ~]# tar -zxvf httpd-2.2.9.tar.gz -C /usr/local/src/
首先是apache构建
编译及安装;
[root@email ~]# cd /usr/local/src/httpd-2.2.9/
[root@email httpd-2.2.9]# ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite
[root@email httpd-2.2.9]# make && make install
[root@email apache2]# ./bin/apachectl start
httpd (pid 14169) already running
2.2
监控
httpd
是否工作!
[root@email apache2]# netstat -tupln |grep http
tcp
0 0 :::80 :::* LISTEN 14169/httpd
[root@email ~]# vim /etc/profile
56 PATH=$PATH:/usr/local/apache2/bin/
[root@email ~]# . /etc/profile
2.3
检测一下环境变量的结果:
[root@email ~]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/apache2/bin/
[root@email ~]# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
[root@email ~]# cd /etc/ld.so.conf.d/
[root@email ld.so.conf.d]# vim apache2.conf
1 /usr/local/apache2/bin/
[root@email ld.so.conf.d]# ldconfig -v |grep apache
/usr/local/apache2/bin:
2.4
配置
mysql
数据库
[root@email ~]# useradd -M -s /sbin/nologin mysql
[root@email ~]# tar -zxvf mysql-5.0.95.tar.gz -C /usr/local/src/
[root@email ~]# cd /usr/local/src/
[root@email src]# ll
total 16
drwxr-xr-x 12 mysql games 4096 Mar 21 00:54 httpd-2.2.9
drwxrwxrwx 38 7155 wheel 4096 Dec 16 20:22 mysql-5.0.95
[root@email src]# ln -s mysql-5.0.95/ mysql
[root@email mysql]# ./configure --prefix=/usr/local/mysql
[root@email mysql]# make && make install
[root@email mysql]# cp support-files/my-medium.cnf /etc/my.cnf
初始化:
[root@email mysql]# /usr/local/mysql/bin/mysql_install_db --user=mysql
[root@email mysql]# chown -R root:mysql /usr/local/mysql
[root@email mysql]# chown -R mysql /usr/local/mysql/var
增加库文件的路径
[root@email mysql]# vim /etc/ld.so.conf.d/mysql.conf
1 /user/local/mysql/lib/mysql/
[root@email mysql]# ldconfig -v |grep mysql
/usr/local/mysql/lib/mysql:
libmysqlclient.so.15 -> libmysqlclient.so.15.0.0
后台安全启动
[root@email mysql]# /usr/local/mysql/bin/mysqld_safe --user=mysql &
[1] 11515
[root@email mysql]# Starting mysqld daemon with databases from /usr/local/mysql/var
复制启动脚本;
[root@email mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@email mysql]# chmod +x /etc/init.d/mysqld
[root@email mysql]# chkconfig --add mysqld
[root@email mysql]# chkconfig mysqld on
启动mysql数据库;
[root@email mysql]# service mysqld start
Starting MySQL
[ OK ]
设置系统全局的环境变量PATH,方便使用mysql数据库!
[root@email mysql]# echo "PATH=$PATH:/usr/local/mysql/bin">>/etc/profile
配置php
[root@postfix ~]# tar -jxvf php-5.4.0.tar.bz2 -C /usr/local/src/
[root@postfix ~]# cd /usr/local/src/php-5.4.0/
编译安装!
[root@postfix php-5.4.0]# ./configure --prefix=/usr/local/php5 --enable-mbstring --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php5
[root@postfix php-5.4.0]# make && make install
复制配置文件
修改apache服务的配置文件使其支持php
[root@postfix php-5.4.0]# vim /usr/local/apache2/conf/httpd.conf
55 LoadModule php5_module modules/php5.so
166
167
DirectoryIndex index.php index.html
168
310
AddType application/x-httpd-php .php
[root@email apache2]# ./bin/apachectl start
httpd: apr_sockaddr_info_get() failed for postfix.email
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
httpd (pid 26531) already running
测试结果:整合成功!
1、php与apache
[root@postfix php-5.4.0]# cd /usr/local/apache2/htdocs/
[root@postfix htdocs]# cat index.php
2、mysql与apache整合测试:
[root@email htdocs]# vim index.php
1
2 $link=mysql_connect('127.0.0.1','root','');
3 if ($link)
4 echo "it's ok!";
5 else
6 echo "you're fail!";
7 ?>
8
三、安装
postfix
软件:
3.1
卸载
sendmail
,因为
25
端口跟
postfix
的端口相冲突!!
[root@email htdocs]# service sendmail stop
Shutting down sm-client:
[ OK ]
Shutting down sendmail:
[ OK ]
[root@email htdocs]# chkconfig sendmail off
3.2
增加组和用户
[root@email ~]# groupadd -g 1200 postdrop
[root@email ~]# groupadd -g 1000 postfix
[root@email ~]# useradd -M -u 1000 -g postfix -G postdrop -s /sbin/nologin postfix
3.3
安装
postfix
软件及依赖包
[root@email ~]# tar -zxvf postfix-2.8.2.tar.gz -C /usr/local/src/
[root@email ~]# cd /usr/local/src/postfix-2.8.2/
[root@email postfix-2.8.2]# make -f Makefile.init makefiles
'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include/mysql' 'AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm'
[root@email postfix-2.8.2]# make && make install
[root@email postfix-2.8.2]# newaliases
【安装的过程中会出现互相提问,直接选择默认的设置即可!】
3.4 postfix
的主配置文件修改
[root@email postfix-2.8.2]# vim /etc/postfix/main.cf
75 myhostname = mail.gxy.com
83 mydomain = gxy.com
99 myorigin = $mydomain
113 inet_interfaces = all
162 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain ,
163
mail.$mydomain, www.$mydomain, ftp.$mydomain
260 mynetworks = 14.14.14.0/24, 127.0.0.0/8
[root@email postfix-2.8.2]# postfix start
postfix/postfix-script: starting the Postfix mail system
[root@email postfix-2.8.2]# postconf check
检查配置
[root@email postfix-2.8.2]# postconf –m
查看是否支持mysql查询
btree
cidr
environ
hash
internal
mysql
nis
proxy
regexp
static
tcp
texthash
unix
【支持mysql模板】
启动的方法:
/usr/local/postfix/sbin/postfix start
[root@postfix han]# rpm2cpio postfix-2.3.3-2.1.el5_2.i386.rpm |cpio –id
[root@postfix han]# cp etc/rc.d/init.d/postfix /etc/rc.d/init.d/
[root@postfix han]# service postfix restart
Shutting down postfix:
[ OK ]
Starting postfix:
[ OK ]
[root@postfix han]# chkconfig postfix on
3.5 smtp
发送验证服务是否能够正常工作!
[root@postfix ~]# useradd user1
[root@postfix ~]# useradd user2
[root@postfix ~]# echo "123" |passwd --stdin user1
Changing password for user user1.
passwd: all authentication tokens updated successfully.
[root@postfix ~]# echo "123" |passwd --stdin user2
Changing password for user user2.
passwd: all authentication tokens updated successfully.
[root@postfix ~]# telnet mail.postfix.email 25
Trying 14.14.14.4...
Connected to mail.postfix.email (14.14.14.4).
Escape character is '^]'.
220 mail.postfix.email ESMTP Postfix
ehlo mail.postfix.email
250-mail.postfix.email
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:[email protected]
250 2.1.0 Ok
rcpt to:[email protected]
250 2.1.5 Ok
data
354 End data with .
test user1 to mail user2
.
250 2.0.0 Ok: queued as 4E3191D050E
quit
221 2.0.0 Bye
Connection closed by foreign host.
[user2@postfix ~]$ mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/user2": 1 message 1 new
>N 1 [email protected]
Wed Mar 21 04:29 13/505
& 1
Message 1:
From [email protected] Wed Mar 21 04:29:26 2012
X-Original-To: [email protected]
Delivered-To: [email protected]
Date: Wed, 21 Mar 2012 04:28:33 +0800 (CST)
From: [email protected]
test user1 to mail user2
&
【说明smtp没有问题!】
四、安装邮局软件
—
提供
pop3/imap4
4.1
安装
dovecot
[root@postfix ~]# useradd –M –s /sbin/nologin dovecot
[root@postfix ~]# tar -zxvf dovecot-1.1.4.tar.gz -C /usr/local/src/
[root@postfix ~]# cd /usr/local/src/dovecot-1.1.4/
[root@postfix dovecot-1.1.4]# groupadd dovecot
[root@postfix dovecot-1.1.4]# ./configure --sysconfdir=/etc --with-mysql
[root@postfix dovecot-1.1.4]# make && make install
4.2
配置
dovecot
文件
[root@postfix dovecot-1.1.4]# cp /etc/dovecot-example.conf /etc/dovecot.conf
[root@postfix dovecot-1.1.4]# vim /etc/dovecot.conf
23 protocols = pop3 imap imaps
47 disable_plaintext_auth = no
87 ssl_disable = yes
208
mail_location = maildir:~/Maildir
[root@postfix dovecot-1.1.4]# vim /etc/postfix/main.cf
415 home_mailbox = Maildir/
4.3
配置
pam
认证文件
[root@postfix dovecot-1.1.4]# vim /etc/pam.d/dovecot
1 auth required pam_nologin.so
2 auth include system-auth
3 account include system-auth
4 session include system-auth
#/usr/local/sbin/dovecot
-c
/etc/dovecot.conf
启动把这句话写入开机脚本
# pkill -1 dovecot #
重新读取dovecot
[root@postfix dovecot-1.1.4]# echo "/usr/local/sbin/dovecot -c /etc/dovecot.conf">/etc/rc.local
[root@postfix dovecot-1.1.4]# useradd dovecot -g dovecot
[root@postfix dovecot-1.1.4]# /usr/local/sbin/dovecot -c /etc/dovecot.conf
[root@postfix dovecot-1.1.4]# netstat -tupln |grep dovecot
tcp
0 0 0.0.0.0:110 0.0.0.0:* LISTEN 14662/dovecot
tcp
0 0 0.0.0.0:143 0.0.0.0:* LISTEN 14662/dovecot
4.4
使用
pop3
邮件测试:
[root@postfix ~]# telnet mail.postfix.emai 110
Trying 14.14.14.4...
Connected to mail.postfix.emai (14.14.14.4).
Escape character is '^]'.
+OK Dovecot ready.
user user1
+OK
pass 123
+OK Logged in.
list
+OK 0 messages:
.
quit
+OK Logging out.
Connection closed by foreign host.
五、安装
webmail
软件
5.1 squirrelmail
安装
[root@postfix ~]# tar -zxvf squirrelmail-webmail-1.4.22.tar.gz -C /usr/local/apache2/htdocs/
[root@postfix ~]# cd /usr/local/apache2/htdocs/
[root@postfix htdocs]# mv squirrelmail-webmail-1.4.22/ webmail
5.2
配置
webmail
[root@postfix webmail]# mkdir -p attach data/
[root@postfix webmail]# chown -R daemon:daemon attach/ data/
[root@postfix webmail]# chmod 730 attach/
[root@postfix webmail]# cp config/config_default.php config/config.php
[root@postfix webmail]# vim config/config.php
118 $domain = 'gxy.com';
146 $smtpServerAddress = 'localhost';
151 $smtpPort = 25;
210 $imapPort = 143;
231 $imap_server_type = 'dovecot';
499 $data_dir = '/usr/local/apache2/htdocs/webmail/data/';
517 $p_w_upload_dir = '/usr/local/apache2/htdocs/webmail/attach/';
重启apache服务
[root@postfix webmail]# /usr/local/apache2/bin/apachectl restart
5.3
客户端在
IE
地址栏中输入:
http://mail.gxy.com/webmail进行测试:
【到这里的时候我们的postfix+webmail安装完成,为了使我们更好的管理维护邮件服务器的前端与后天接口我们来安装extmail和extman实现我们的需求!】
六
初始化
extman
软件
6.1
数据库脚本:
[root@postfix ~]# service mysqld restart
Shutting down MySQL...
[ OK ]
Starting MySQL..
[ OK ]
[root@postfix ~]# tar -zxvf extman-1.1.tar.gz -C /usr/local/src/
[root@postfix ~]# cd /usr/local/src/extman-1.1/docs/
脚本导入到数据库中
一般情况下密码为空:
[root@postfix docs]# mysql -u root -p < extmail.sql
[root@postfix ~]# cd /usr/local/src/extman-1.1/docs/
[root@postfix docs]# mysql -u root -p < extmail.sql
Enter password:
[root@postfix docs]# mysql -u root -p < init.sql
Enter password:
七
配置
postfix
7.1
修改配置文件
[root@postfix docs]# vim /etc/postfix/main.cf
162 #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomai
n,
163 #
mail.$mydomain, www.$mydomain, ftp.$mydomain
652 virtual_mailbox_base = /mailbox
653 virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
654 virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps
.cf
655 virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_map
s.cf
656 virtual_uid_maps = static:1000
657 virtual_gid_maps = static:1000
658 virtual_transport = virtual
659
[root@postfix docs]# cd /usr/local/src/extman-1.1/docs/
[root@postfix docs]# cp mysql_virtual_* /etc/postfix/
八
虚拟用户设置
smtp
发信认证
8.1
安装软件
[root@postfix ~]# tar -jxvf courier-authlib-0.62.4.tar.bz2 -C /usr/local/src/
[root@postfix ~]# cd /usr/local/src/courier-authlib-0.62.4/
[root@postfix courier-authlib-0.62.4]# ./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
[root@postfix courier-authlib-0.62.4]# make && make install
[root@postfix courier-authlib-0.62.4]# make install-configure生成默认配置文件authmysqlrc 和 authdaemonrc
8.2
增加courier-authlib
的库文件路径
[root@postfix courier-authlib-0.62.4]# vim /etc/ld.so.conf
2 /usr/local/courier-authlib/lib/courier-authlib
[root@postfix courier-authlib-0.62.4]# ldconfig
重新读取配置文件;
8.3
修改
authdaemonrc
主配置文件
[root@postfix courier-authlib-0.62.4]# cd /usr/local/courier-authlib/etc/authlib/
[root@postfix authlib]# cp authdaemonrc authdaemonrc.bak
[root@postfix authlib]# vim authdaemonrc
27 authmodulelist="authmysql"
34 authmodulelistorig="authmysql"
[root@postfix authlib]# chmod -R 755 /usr/local/courier-authlib/var/spool/authdaemon
8.4
修改
authmysqlrc
文件
[root@postfix authlib]# cp authmysqlrc authmysqlrc.bak
[root@postfix authlib]# vim authmysqlrc
26 MYSQL_SERVER
localhost
27 MYSQL_USERNAME
extmail
28 MYSQL_PASSWORD
extmail
49 MYSQL_SOCKET
/tmp/mysql.sock
56 MYSQL_PORT
3306
68 MYSQL_DATABASE
extmail
83 MYSQL_USER_TABLE
mailbox
92 MYSQL_CRYPT_PWFIELD
password
113 MYSQL_UID_FIELD
uidnumber
119 MYSQL_GID_FIELD
gidnumber
128 MYSQL_LOGIN_FIELD
username
133 MYSQL_HOME_FIELD
concat('/mailbox'./homedir)
139 MYSQL_NAME_FIELD
name
150 MYSQL_MAILDIR_FIELD
concat('/mailbox/',maildir)
8.5
复制脚本,启动服务
[root@postfix authlib]# cd /usr/local/src/courier-authlib-0.62.4/
[root@postfix courier-authlib-0.62.4]# cp courier-authlib.sysvinit /etc/init.d/courier-authlib
[root@postfix courier-authlib-0.62.4]# chmod 755 /etc/rc.d/init.d/courier-authlib
[root@postfix courier-authlib-0.62.4]# service courier-authlib start
Starting Courier authentication services: authdaemond
九
修改
cyrus sasl
设置
[root@postfix ~]# vim /usr/lib/sasl2/smtpd.conf
1 pwcheck_method:authdaemond
2 authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socke
t
十
修改
dovecot
配置:
10.1
修改
dovecot
的主配置文件
[root@postfix ~]# vim /etc/dovecot.conf
208 mail_location = maildir:/mailbox/%d/%n/Maildir
791 auth default {
791 auth default {
796
mechanisms = plain
829 # passdb pam {
858
#}
900
passdb sql {
902
args = /etc/dovecot-mysql.conf
903
}
963
userdb sql {
965
args = /etc/dovecot-mysql.conf
966
}
手动:
10.2
建立数据查询配置文件:
[root@postfix ~]# 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’
查询用户身份语句
十一
建立虚拟用户:
11.1
建立邮箱目录并修改权限
[root@postfix ~]# mkdir -p /mailbox/extmail.org/postmaster/Maildir
[root@postfix ~]# cd /mailbox/extmail.org/postmaster/Maildir
[root@postfix Maildir]# chown -R postfix:postfix /mailbox
[root@postfix Maildir]# dovecot
Fatal: Dovecot is already running with PID 29929 (read from /usr/local/var/run/dovecot/master.pid)
11.2
虚拟用户测试
[root@postfix Maildir]# /usr/local/courier-authlib/sbin/authtest -s login [email protected] extmail
Authentication succeeded.
Authenticated: [email protected] (uid 1000, gid 1000)
Home Directory: /mailbox/extmail.org/postmaster
Maildir: /mailbox/extmail.org/postmaster/Maildir/
Quota: (none)
Encrypted Password: $1$phz1mRrj$3ok6BjeaoJYWDBsEPZb5C0
Cleartext Password: extmail
Options: (none)
十二
extmail
平台
12.1 平台安装
3个倚赖包
[root@localhost mail]# tar -zxvf Unix-Syslog-1.1.tar.gz -C /usr/local/src
[root@localhost mail]# cd /usr/local/src/Unix-Syslog-1.1
[root@localhost Unix-Syslog-1.1]# perl Makefile.PL
[root@localhost Unix-Syslog-1.1]# make
[root@localhost Unix-Syslog-1.1]# make install
[root@localhost mail]# tar -zxvf DBI-1.616.tar.gz -C /uar/local/src
[root@localhost mail]# cd /usr/local/src/DBI-1.616
[root@localhost DBI-1.616]# perl Makefile.PL
[root@localhost DBI-1.616]# make
[root@localhost DBI-1.616]# make install
[root@localhost mail]# tar -zxvf DBD-mysql-4.020.tar.gz -C /usr/local/src
[root@localhost mail]# cd /usr/loca/src/DBD-4.020
[root@localhost DBD-mysql-4.020]# perl Makefile.PL
[root@localhost DBD-mysql-4.020]# make
[root@localhost DBD-mysql-4.020]# make install
注意以上三个包在编译安装过程可能会提示 警告信息 隐式函数 计算出的变量值未被使用等,只要没有error信息就一切ok
安装ExtMail
[root@localhost mail]# tar -zxvf extmail-1.0.5.tar.gz -C /usr/local/apache2/htdocs
[root@localhost mail]# cd /usr/local/apache2/htdocs
[root@localhost htdocs]# mv extmail-1.0.5 extmail
[root@localhost htdocs]# cd extmail
[root@localhost extmail]# chown -R postfix:postfix cgi
[root@localhost extmail]# cp webmail.cf.default webmail.cf
12.2
修改配置文件
[root@localhost extmail]#vim webmail.cf
SYS_CONFIG = /usr/local/apache2/htdocs/extmail/ 程序根目录
SYS_LANGDIR = /usr/local/apache2/htdocs/extmail/lang 语言包文件目录
SYS_TEMPLDIR = /usr/local/apache2/htdocs/extmail/html 系统模版目录
SYS_MAILDIR_BASE = /mailbox 邮件存储目录
SYS_MYSQL_USER = extmail 访问mysql数据库的用户
SYS_MYSQL_PASS = extmail 访问mysql数据库的用户的密码
SYS_MYSQL_DB = extmail
使用数据库的名称
SYS_MYSQL_HOST = localhost 数据库服务器地址
SYS_MYSQL_SOCKET = /tmp/mysql.sock 数据库套接文件位置
12.3
修改
apache
服务,添加虚拟主机
[root@localhost extmail]#vim /usr/local/apache2/conf/httpd.conf
添加如下内容:
NameVirtualHost *:80
ServerName mail.lywh.com
DocumentRoot /usr/local/apache2/htdocs/extmail/html/
ScriptAlias /extmail/cgi/ "/usr/local/apache2/htdocs/extmail/cgi/"
Alias /extmail "/usr/local/apache2/htdocs/extmail/html/"
User postfix
找到 User 该用户为postfix
Group postfix
找到 Group 该组为postfix
这里由于前面我们并没有启用Suexec 所以我们没有在虚拟主机中添加 SuexecUerGroup postfix postfix
[root@localhost extmail]#/usr/local/apache2/bin/apachectl restart
//重启服务
十三
extman
平台
13.1
安装包:
5个倚赖包
[root@localhost mail]# tar -zxvf GD-2.46.tar.gz -C /usr/local/src
[root@localhost mail]# cd /usr/local/src/GD-2.46
[root@localhost GD-2.46]# perl Makefile.PL
[root@localhost GD-2.46]# make
[root@localhost GD-2.46]# make install
[root@localhost mail]# tar -zxvf File-Tail-0.99.3.tar.gz -C /uar/local/src
[root@localhost mail]# cd /usr/local/src/File-Tail-0.99.3
[root@localhost File-Tail-0.99.3]# perl Makefile.PL
[root@localhost File-Tail-0.99.3]# make
[root@localhost File-Tail-0.99.3]# make install
[root@localhost mail]# rpm -ivh rrdtool-1.2.23-3.el5.i386.rpm
[root@localhost mail]# rpm -ivh rrdtool-perl-1.2.23-3.el5.i386.rpm
Extman 套件
[root@localhost mail]# tar -zxvf extman-0.2.5.tar.gz -C /usr/local/apache2/htdocs
[root@localhost mail]# cd /usr/local/apache2/htdocs
[root@localhost htdocs]# mv extman-0.2.5 extman
[root@localhost htdocs]# cd extman
[root@localhost extman]# chown -R postfix:postfix cgi
[root@localhost extman]# mkdir /tmp/extman
// 临时回话保存目录
[root@localhost extman]# chown -R postfix:postfix /tmp/extman
13.2 修改配置文件
[root@localhost extman]# vim /usr/local/apache2/htdocs/extman/webman.cf
修改如下内容:
SYS_CONFIG = /usr/local/apache2/htdocs/extman/ 程序根目录
SYS_LANGDIR = /usr/local/apache2/htdocs/extman/lang 语言包文件目录
SYS_TEMPLDIR = /usr/local/apache2/htdocs/extman/html 系统模版目录
SYS_MAILDIR_BASE = /mailbox 邮件数据存放路径
SYS_MYSQL_USER = webman 访问
mysql数据库的用户
SYS_MYSQL_PASS = webman 访问
mysql数据库的用户的密码
SYS_MYSQL_DB = extmail 使用的数据库名称
SYS_MYSQL_HOST = localhost 数据库服务器地址
SYS_MYSQL_SOCKET = /tmp/mysql.sock 数据库套接文件位置
13.3 调整apache主配文件。添加extman相关目录别名
[root@localhost extman]# vim /usr/local/apache2/conf/httpd.conf
修改内容如下:
NameVirtualHost *:80
ServerName mail.lywh.com
DocumentRoot /usr/local/apache2/htdocs/extmail/html/
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/"
#/usr/local/apache2/bin/apachectl restart
测试:
默认管理员账户:
[email protected]
默认密码:extmail*123*
登录后界面如下:
十四
设置邮件系统图形化日志信息:
[root@postfix ~]# ln -sf /usr/local/apache2/htdocs/extman/addon/mailgraph_ext/mailgraph-init /usr/sbin/
[root@postfix ~]#
[root@postfix ~]# ln -sf /usr/local/apache2/htdocs/extman/addon/mailgraph_ext/qmonitor.pl /usr/sbin/
[root@postfix ~]#
[root@postfix ~]# cp -a /usr/local/apache2/htdocs/extman/addon/mailgraph_ext/ /usr/local/
[root@postfix ~]# mailgraph-init start
Starting mail statistics grapher: mailgraph_ext
Starting queue statistics grapher: qmonitor
[root@postfix ~]# qmonitor.pl start &
[1] 5908
[root@postfix ~]#
[root@postfix ~]# echo "/usr/sbin/qmoonitor.pl start" >> /etc/rc.d/rc.local
[root@postfix ~]#
[root@postfix ~]# echo "/usr/sbin/mailgraph-init start" >> /etc/rc.d/rc.local
大致测试图形: