Postfix是一款基于开源环境,用于取代在开源环境中Sendmail的一种尝试。与Sendmail相比postfix更快、更安全、更加易于管理,于此同时还与Sendmail保持了足够的兼容性。

下面是基于Postfix配合Dovecat、Extmail与Extman实现提供具有SASL认证的web服务的邮件服务器

构建Postfix邮件服务器_第1张图片

下面对postfix邮件服务器的具体构建、以及各部分的测试过程进行详述:

一、安装前的准备工作

为了实现完整的邮件服务器功能,我们需要具有解析本域邮件服务器功能的DNS Server,具体过程不再赘述,可以参考作者博文:《Linux下DNS服务器搭建详解》http://evolution.blog.51cto.com/3343305/643520

1.安装所需的rpm包

   
   
   
   
  1. yum install -y httpd php php-mysql mysql mysql-server mysql-devel openssl-devel dovecot perl-DBD-MySQL tcl tcl-devel libart_lgpl libart_lgpl-devel libtool-ltdl libtool-ltdl-devel 
  2. #为了降低搭建过程的复杂程度,这里作者将非必须编译安装的软件使用yum源来安装 

2.关闭sendmail,并卸载

   
   
   
   
  1. service sendmail stop 
  2. chkconfig sendmail off 
  3. rpm -e --nodeps sendmail 
  4. #卸载sendmail防止影响后面postfix的安装工作 

3.安装编译安装时需要用到的开发包组

   
   
   
   
  1. yum -y groupinstall "Development Libraries" "Development Tools" "Legacy Software Development" "X Software Development" 

4.启动Mysql数据库,并设置密码

   
   
   
   
  1. service mysqld start 
  2. chkconfig mysqld on 
  3. /usr/bin/mysql 
  4. mysql>SET PASSWORD FOR root@'localhost'=PASSWORD('redhat');    
  5. mysql>SET PASSWORD FOR root@'127.0.0.1'=PASSWORD('redhat');  
  6. #设置本地登录密码 
  7. mysql>GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'redhat'
  8. #设置远程登陆密码 
  9. mysql>FLUSH PRIVILEGES; 
  10. mysql>quit 

5.启动SASL并加入开机启动

   
   
   
   
  1. service saslauthd start 
  2. chkconfig saslauthd on 

二、安装配置Postfix

1.编译安装

   
   
   
   
  1. groupadd -g 2525 postfix   
  2. useradd -g postfix -u 2525 -s /sbin/nologin -M postfix 
  3. groupadd -g 2526 postdrop 
  4. useradd -g postdrop -u 2526 -s /bin/false -M postdrop 
  5. #创建postfix用户 
  6. tar zxvf postfix-2.6.5.tar.gz  
  7. cd postfix-2.6.5 
  8. make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl  -DUSE_TLS ' 'AUXLIBS=-L/usr/lib/mysql -lmysqlclient -lz -lm -L/usr/lib/sasl2 -lsasl2   -lssl -lcrypto' 
  9. #编译选项:gcc的编译选项;mysql头文件;支持sasl认证;cyrus_sasl的头文件;mysql的客户端;指明auxlibs的位置 
  10. make 
  11. make install 

   
   
   
   
  1. 以下是安装时提示输入的内容,“[]”中为默认值 
  2. install_root: [/] / 
  3. tempdir: [/usr/local/src/ postfix-2.6.5] /tmp 
  4. config_directory: [/etc/postfix] /etc/postfix 
  5. daemon_directory: [/usr/libexec/postfix]  
  6. command_directory: [/usr/sbin]  
  7. queue_directory: [/var/spool/postfix] 
  8. sendmail_path: [/usr/sbin/sendmail] 
  9. newaliases_path: [/usr/bin/newaliases] 
  10. mailq_path: [/usr/bin/mailq] 
  11. mail_owner: [postfix] 
  12. setgid_group: [postdrop]    
  13. html_directory: [no] /var/www/postfix_html 
  14. manpages: [/usr/local/man] 
  15. readme_directory: [no

编译安装完成后

   
   
   
   
  1. newaliases 
  2. 生成别名二进制文件,这个步骤如果忽略,会造成postfix效率极低。 

2.配置postfix

   
   
   
   
  1. vim /etc/postfix/main.cf 
  2. myhostname = mail.evo.com 
  3. #指定运行postfix邮件系统的主机的主机名 
  4. myorigin = evo.com 
  5. #指明发件人所在的域名 
  6. mydomain = evo.com 
  7. #邮件服务器的域名 
  8. mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain 
  9. #指定postfix接收邮件时收件人的域名 
  10. mynetworks = 192.168.0.0/24, 127.0.0.0/8 
  11. #指定你所在的网络的网络地址 
  12. inet_interfaces  
  13. #参数指定postfix系统监听的网络接口 

3.添加postfix启动脚本

   
   
   
   
  1. vim /etc/init.d/postfix 
  2.  
  3. #!/bin/bash 
  4. . /etc/rc.d/init.d/functions 
  5. . /etc/sysconfig/network 
  6. [ ${NETWORKING} = "no" ] && exit 0 
  7.  
  8. [ -x /usr/sbin/postfix ] || exit 0 
  9. [ -d /etc/postfix ] || exit 0 
  10. [ -d /var/spool/postfix ] || exit 0 
  11.  
  12. RETVAL=0 
  13. prog="postfix" 
  14.  
  15. start() { 
  16.     # Start daemons. 
  17.     echo -n $"Starting postfix: " 
  18.         /usr/bin/newaliases >/dev/null 2>&1 
  19.     /usr/sbin/postfix start 2>/dev/null 1>&2 && success || failure $"$prog start" 
  20.     RETVAL=$? 
  21.     [ $RETVAL -eq 0 ] && touch /var/lock/subsys/postfix 
  22.         echo 
  23.     return $RETVAL 
  24.  
  25. stop() { 
  26.         # Stop daemons. 
  27.     echo -n $"Shutting down postfix: " 
  28.     /usr/sbin/postfix stop 2>/dev/null 1>&2 && success || failure $"$prog stop" 
  29.     RETVAL=$? 
  30.     [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/postfix 
  31.     echo 
  32.     return $RETVAL 
  33.  
  34. reload() { 
  35.     echo -n $"Reloading postfix: " 
  36.     /usr/sbin/postfix reload 2>/dev/null 1>&2 && success || failure $"$prog reload" 
  37.     RETVAL=$? 
  38.     echo 
  39.     return $RETVAL 
  40.  
  41. abort() { 
  42.     /usr/sbin/postfix abort 2>/dev/null 1>&2 && success || failure $"$prog abort" 
  43.     return $? 
  44.  
  45. flush() { 
  46.     /usr/sbin/postfix flush 2>/dev/null 1>&2 && success || failure $"$prog flush" 
  47.     return $? 
  48.  
  49. check() { 
  50.     /usr/sbin/postfix check 2>/dev/null 1>&2 && success || failure $"$prog check" 
  51.     return $? 
  52.  
  53. restart() { 
  54.     stop 
  55.     start 
  56.  
  57. # See how we were called. 
  58. case "$1" in 
  59.   start) 
  60.     start 
  61.     ;; 
  62.   stop) 
  63.     stop 
  64.     ;; 
  65.   restart) 
  66.     stop 
  67.     start 
  68.     ;; 
  69.   reload) 
  70.     reload 
  71.     ;; 
  72.   abort) 
  73.     abort 
  74.     ;; 
  75.   flush) 
  76.     flush 
  77.     ;; 
  78.   check) 
  79.     check 
  80.     ;; 
  81.   status) 
  82.     status master 
  83.     ;; 
  84.   condrestart) 
  85.     [ -f /var/lock/subsys/postfix ] && restart || : 
  86.     ;; 
  87.   *) 
  88.     echo $"Usage: $0 {start|stop|restart|reload|abort|flush|check|status|condrestart}" 
  89.     exit 1 
  90. esac 
  91.  
  92. exit $? 

   
   
   
   
  1. chmod +x postfix 
  2. #给脚本执行权限 
  3. chkconfig --add postfix 
  4. #添加默认2345运行级别随系统启动 
  5. service postfix start 
  6. #启动postfix 

4.测试postfix,验正服务启动状况

   
   
   
   
  1. >telnet 192.168.0.71 25 
  2. Trying 192.168.0.71... 
  3. Connected to station71.redhat_hu.com (192.168.0.71). 
  4. Escape character is '^]'
  5. 220 mail.evo.com ESMTP Postfix 
  6. >ehlo mail.evo.com 
  7. 250-mail.evo.com 
  8. 250-PIPELINING 
  9. 250-SIZE 10240000 
  10. 250-VRFY 
  11. 250-ETRN 
  12. 250-ENHANCEDSTATUSCODES 
  13. 250-8BITMIME 
  14. 250 DSN 
  15. >mail from:root@evo.com 
  16. 250 2.1.0 Ok 
  17. >rcpt to:root@evo.com 
  18. 250 2.1.5 Ok 
  19. >data 
  20. 354 End data with . 
  21. >subject:test 
  22. >test 123... 
  23. >. 
  24. 250 2.0.0 Ok: queued as 7AAD51B803D 
  25. >quit 
  26. 221 2.0.0 Bye 
  27. Connection closed by foreign host. 
  28. You have mail in /var/spool/mail/root 
  29. #已有提示收到测试邮件 
  30. >mail 
  31. #查看邮箱 
  32. Mail version 8.1 6/6/93.  Type ? for help. 
  33. "/var/spool/mail/root": 1 message 1 new 
  34. N  1 root@evo.com          Sun Aug 14 20:03  15/481   "test" 

三、为postfix开启基于cyrus-sasl的认证功能

1.编辑postfix配置文件

   
   
   
   
  1. vi /etc/postfix/main.cf 
  2. 添加以下内容: 
  3. broken_sasl_auth_clients = yes 
  4. #定义是否允许突破sasl认证 
  5. 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 
  6. smtpd_sasl_auth_enable = yes 
  7. #启动sasl认证 
  8. smtpd_sasl_local_domain = $myhostname 
  9. #本域名定义 
  10. smtpd_sasl_security_options = noanonymous 
  11. #不支持匿名 
  12. smtpd_sasl_application_name = smtpd 
  13. smtpd_banner = Welcome to our $myhostname ESMTP,Warning: Version has been hidden! 
  14. #隐藏版本信息 

2.编辑stmtpd服务配置文件

   
   
   
   
  1. vim /usr/lib/sasl2/smtpd.conf 
  2. pwcheck_method: saslauthd 
  3. #密码检验方法为sasl认证 
  4. mech_list: PLAIN LOGIN 

3.重启postfix服务

   
   
   
   
  1. service postfix restart 

4.测试SASL认证

   
   
   
   
  1. >telnet 192.168.0.71 25 
  2. Trying 192.168.0.71... 
  3. Connected to station71.redhat_hu.com (192.168.0.71). 
  4. Escape character is '^]'
  5. 220 Welcome to our mail.evo.com ESMTP,Warning: Version has been hidden. 
  6. >ehlo mail.evo.com  
  7. 250-mail.evo.com 
  8. 250-PIPELINING 
  9. 250-SIZE 10240000 
  10. 250-VRFY 
  11. 250-ETRN 
  12. 250-AUTH PLAIN LOGIN 
  13. 250-AUTH=PLAIN LOGIN   
  14. #有以上两行说明CYRUS-SASL认证添加成功 
  15. 250-ENHANCEDSTATUSCODES 
  16. 250-8BITMIME 
  17. 250 DSN 
  18. >quit 
  19. 221 2.0.0 Bye 
  20. Connection closed by foreign host. 

四、安装Courier authentication library

注意:请确保安装libtool-ltdl,libtool-ltdl-devel不然编译过程会报错

1.编译安装Courier auth

   
   
   
   
  1. tar jxvf courier-authlib-0.62.4.tar.bz2 
  2. cd courier-authlib-0.62.4 
  3. ./configure --prefix=/usr/local/courier-authlib --sysconfdir=/etc --with-authmysql --with-mysql-libs=/usr/lib/mysql --with-mysql-includes=/usr/include/mysql --with-redhat --with-authmysqlrc=/etc/authmysqlrc --with-authdaemonrc=/etc/authdaemonrc CFLAGS="-march=i686 -O2 -fexpensive-optimizations"   CXXFLAGS="-march=i686 -O2 -fexpensive-optimizations" 
  4. make 
  5. make install 

2.编辑配置文件

   
   
   
   
  1. chmod 755 /usr/local/courier-authlib/var/spool/authdaemon 
  2. cp /etc/authdaemonrc.dist  /etc/authdaemonrc 
  3. cp /etc/authmysqlrc.dist  /etc/authmysqlrc 
  4.  
  5. vim /etc/authdaemonrc  
  6. authmodulelist="authmysql" 
  7. authmodulelistorig="authmysql"     
  8. daemons=10 
  9. #修改这3行 
  10. vim /etc/authmysqlrc  
  11. MYSQL_SERVER localhost 
  12. MYSQL_PORT 3306                   
  13. #指定你的mysql监听的端口,这里使用默认的3306 
  14. MYSQL_USERNAME  extmail       
  15. #这时为后文要用的数据库的所有者的用户名 
  16. MYSQL_PASSWORD extmail         
  17. #密码 
  18. MYSQL_SOCKET  /var/lib/mysql/mysql.sock  
  19. #此行前注释去掉 
  20. MYSQL_DATABASE  extmail          
  21. MYSQL_USER_TABLE  mailbox 
  22. MYSQL_CRYPT_PWFIELD  password 
  23. MYSQL_UID_FIELD  '2525' 
  24. MYSQL_GID_FIELD  '2525' 
  25. #2525,2525 为postfix 用户的UID和GID 
  26. MYSQL_LOGIN_FIELD  username 
  27. MYSQL_HOME_FIELD  concat('/var/mailbox/',homedir)        
  28. #本地邮箱的位置 
  29. MYSQL_NAME_FIELD  name 
  30. MYSQL_MAILDIR_FIELD  concat('/var/mailbox/',maildir)   

3.为courier添加启动脚本

   
   
   
   
  1. cp courier-authlib.sysvinit /etc/init.d/courier-authlib             #courier提供的启动脚本 
  2. chmod 755 /etc/init.d/courier-authlib 
  3. chkconfig --add courier-authlib 
  4. chkconfig courier-authlib on 

4.添加库文件并测试导入情况

   
   
   
   
  1. echo "/usr/local/courier-authlib/lib/courier-authlib" >> /etc/ld.so.conf   
  2. #或添加到/etc/ld.so.conf.d/courier.conf 
  3. ldconfig -v | grep courier 
  4. #有如下显示表示库文件添加成功 
  5. /usr/local/courier-authlib/lib/courier-authlib: 
  6.     libcourierauthcommon.so -> libcourierauthcommon.so.0 
  7.     libcourierauth.so -> libcourierauth.so.0 
  8.     libcourierauthsasl.so -> libcourierauthsasl.so.0 
  9.     libcourierauthsaslclient.so -> libcourierauthsaslclient.so.0 

5.启动courier-authlib服务

   
   
   
   
  1. service courier-authlib start    
  2. #启动服务 
  3. ps aux |grep courier 
  4. #查看进程启动状态 

6.创建虚拟用户邮箱目录

   
   
   
   
  1. mkdir –pv /var/mailbox 
  2. #新建虚拟用户邮箱所在的目录,并将其权限赋予postfix用户 
  3. chown –R postfix /var/mailbox    
  4. #所有用户的邮件都在这里 

7.重新修改smtpd服务配置文件,确保是如下内容

   
   
   
   
  1. pwcheck_method: authdaemond 
  2. log_level: 3 
  3. mech_list:PLAIN LOGIN 
  4. authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket 
  5. #添加这些内容进去 

五、让postfix支持虚拟域和虚拟用户

1.编辑postfix配置文件,添加如下内容于配置文件末行

   
   
   
   
  1. vim /etc/postfix/main.cf 
  2. virtual_mailbox_base = /var/mailbox 
  3. #指明虚拟用户邮件目录 
  4. virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf 
  5. virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf 
  6. virtual_alias_domains = 
  7. virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf 
  8. virtual_uid_maps = static:2525 
  9. virtual_gid_maps = static:2525 
  10. virtual_transport = virtual 
  11. maildrop_destination_recipient_limit = 1 
  12. maildrop_destination_concurrency_limit = 1  
  13. message_size_limit = 14336000 
  14. virtual_mailbox_limit = 20971520 
  15. virtual_create_maildirsize = yes 
  16. virtual_mailbox_extended = yes 
  17. virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf 
  18. virtual_mailbox_limit_override = yes 
  19. virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please Tidy your mailbox and try again later. 
  20. virtual_overquota_bounce = yes 

2.添加extmail数据进mysql数据库

   
   
   
   
  1. tar zxvf  extman-1.1.tar.gz 
  2. cd extman-1.1/docs 
  3. mysql -u root -p 
  4. #添加extmail.sql数据库到mysql 
  5. mysql -u root -p 
  6. #添加init.sql数据库到mysql 
  7. cp mysql*  /etc/postfix/ 

3.授予用户extmail访问extmail数据库的权限

   
   
   
   
  1. mysql> GRANT all privileges on extmail.* TO extmail@localhost IDENTIFIED BY 'extmail'
  2. mysql> GRANT all privileges on extmail.* TO extmail@127.0.0.1 IDENTIFIED BY 'extmail'

4.在此修改postfix配置文件

为了支持虚拟用户,需要对/etc/postfix/main.cf即postfix的配置文件做如下修改:

虚拟域以后,需要取消中心域,注释掉myhostname, mydestination, mydomain, myorigin,mydestionation几个指令。

六、配置Dovecot

1.编辑dovecot主配置文件

   
   
   
   
  1. vim /etc/dovecot.conf 
  2. mail_location = maildir:/var/mailbox/%d/%n/Maildir    
  3. #修改此项 
  4. auth default {                                                                       
  5.     mechanisms = plain 
  6. #pam {xxxxxxxx}                                                                                             #注意把pam{}这一项注释掉   
  7.  passdb sql { 
  8.         args = /etc/dovecot-mysql.conf                              #添加此项 
  9.     } 
  10.     userdb sql { 
  11.         args = /etc/dovecot-mysql.conf                              #添加此项 
  12.     } 
  13.     

2.编辑dovecot与mysql关联的配置文件

   
   
   
   
  1. vim /etc/dovecot-mysql.conf                  
  2. driver = mysql                                       
  3. connect = host=localhost dbname=extmail user=extmail password=extmail    
  4. default_pass_scheme = CRYPT 
  5. password_query = SELECT username AS user,password AS password FROM mailbox WHERE username = '%u'                             
  6. user_query = SELECT maildir, uidnumber AS uid, gidnumber AS gid FROM mailbox WHERE username = '%u' 

3.启动dovecot服务

   
   
   
   
  1. service dovecot start 
  2. chkconfig dovecot on 

七、安装Extmail

1.解压安装

   
   
   
   
  1. tar zxvf extmail-1.2.tar.gz 
  2. mkdir -pv /var/www/extsuite 
  3. mv extmail-1.2 /var/www/extsuite/extmail 
  4. cp /var/www/extsuite/extmail/webmail.cf.default  /var/www/extsuite/extmail/webmail.cf 
  5. #复制配置文件 

2.修改主配置文件

   
   
   
   
  1. SYS_MESSAGE_SIZE_LIMIT = 5242880 
  2. #用户可以发送的最大邮件 
  3. SYS_USER_LANG = zh_CN 
  4. #语言选项选择中文 
  5. SYS_MAILDIR_BASE = /var/mailbox 
  6. #修改邮件的存放目录 
  7. SYS_MYSQL_USER = extmail 
  8. SYS_MYSQL_PASS = extmail 
  9. #以上两句句用来设置连接数据库服务器所使用用户名、密码和邮件服务器用到的数据库 
  10. SYS_MYSQL_HOST = localhost 
  11. #使用默认选项 
  12. SYS_MYSQL_TABLE = mailbox 
  13. SYS_MYSQL_ATTR_USERNAME = username 
  14. SYS_MYSQL_ATTR_DOMAIN = domain 
  15. SYS_MYSQL_ATTR_PASSWD = password 
  16. #以上用来指定验正用户登录里所用到的表,以及用户名、域名和用户密码分别对应的表中列的名称;使用默认值 
  17. SYS_AUTHLIB_SOCKET = /usr/local/courier-authlib/var/spool/authdaemon/socket 
  18. #此句用来指明authdaemo socket文件的位置 

3.配置apache虚拟主机

   
   
   
   
  1. vim /etc/httpd/conf/httpd.conf 
  2. User postfix 
  3. Group postfix 
  4. #修改这两项 
  5. #DocumentRoot "/var/www/html" 
  6. #注释此项 
  7. NameVirtualHost *:80 
  8. #启用此项 
  9.  
  10. ServerName mail.test.com 
  11. DocumentRoot /var/www/extsuite/extmail/html/ 
  12. ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi 
  13. Alias /extmail /var/www/extsuite/extmail/html 
  14.  
  15. "/var/www/extsuite/extmail/html/"
  16.     Order allow,deny 
  17.     Allow from all 
  18.  
  19. #添加权限 

 

4.解决extmail的依赖关系

   
   
   
   
  1. tar zxvf Unix-Syslog-0.100.tar.gz 
  2. cd Unix-Syslog-0.100 
  3. perl Makefile.PL 
  4. make 
  5. make install 
  6. #编译安装Unix-Syslog 

5.修改 cgi执行文件权限,启动httpd

   
   
   
   
  1. chown -R postfix.postfix /var/www/extsuite/extmail/cgi/ 
  2. service httpd start 
  3. chkconfig httpd on 

八、安装Extman

1.安装extman

   
   
   
   
  1. tar zxvf  extman-1.1.tar.gz 
  2. mv extman-1.1 /var/www/extsuite/extman 

2.编辑extman的配置文件

   
   
   
   
  1. cp /var/www/extsuite/extman/webman.cf.default  /var/www/extsuite/extman/webman.cf 
  2. vim /var/www/extsuite/extman/webman.cf 
  3. SYS_MAILDIR_BASE = /var/mailbox 
  4. #用户邮件的存放目录 
  5. SYS_CAPTCHA_ON = 0   
  6. #关闭验证码功能 
  7. SYS_DEFAULT_UID=2525 
  8. SYS_DEFAULT_UID=2525 
  9. #将虚拟用户映射本地用户2525以下载邮件 

3.修改apache配置文件

在上文虚拟主机配置字段中添加如下两行

   
   
   
   
  1. ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi 
  2. Alias /extman /var/www/extsuite/extman/html 

4.修改权限,使postfix能够使用Ext族组件

   
   
   
   
  1. chown -R postfix.postfix /var/www/extsuite 

5.创建运行时所需的临时文件

   
   
   
   
  1. mkdir  -pv  /tmp/extman 
  2. chown postfix.postfix  /tmp/extman 

九、图形化日志启用

1.按照如下安装顺序安装以下3个软件包

   
   
   
   
  1. tar zxvf Time-HiRes-1.9707.tar.gz 
  2. cd Time-HiRes-1.9707 
  3. perl Makefile.PL 
  4. make 
  5. make test 
  6. make install 
  7. #安装time-hires 
  8. tar zxvf File-Tail-0.99.3.tar.gz 
  9. cd File-Tail-0.99.3 
  10. perl Makefile 
  11. make 
  12. make test 
  13. make install 
  14. #安装file-tail 
  15. tar zxvf rrdtool-1.4.5.tar.gz 
  16. cd rrdtool-1.4.5 
  17. ./configure --prefix=/usr/local/rrdtool 
  18. make 
  19. make install 
  20. #安装rrdtool 

2.创建必须得符号链接

   
   
   
   
  1. ln -vs /usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/auto/RRDs/RRDs.so /usr/lib/perl5/5.8.8/i386-linux-thread-multi/ 
  2. ln -vs /usr/local/rrdtool/lib/perl/5.8.8/RRDp.pm /usr/lib/perl5/5.8.8/ 
  3. ln -vs /usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/RRDs.pm /usr/lib/perl5/5.8.8/ 

3.调整文件并启动服务

   
   
   
   
  1. cp -r /var/www/extsuite/extman/addon/mailgraph_ext  /usr/local   
  2. #复制mailgraph_ext到/usr/local 
  3. /usr/local/mailgraph_ext/mailgraph-init start  
  4. #启动服务 
  5.  /var/www/extsuite/extman/daemon/cmdserver --daemon 
  6. #启动cmdserver在后台显示系统信息 
  7.  
  8. echo “/usr/local/mailgraph_ext/mailgraph-init start” >> /etc/rc.d/rc.local 
  9. echo “/var/www/extsuite/extman/daemon/cmdserver -v -d” >> /etc/rc.d/rc.local  
  10. #添加这两条,使其能够在系统初始化完成后实行启动脚本 

 到此我们的配置就已经完成了,由于作者使用的是VMware虚拟机故这里将物理机首选DNS指向虚拟机ip,浏览器中输入邮件服务器域名即可登入。

首次登陆:使用管理员账号/密码

管理帐号为:[email protected]  密码为:extmail*123*

 

构建Postfix邮件服务器_第2张图片

 图形化统计日志

 

构建Postfix邮件服务器_第3张图片

 Ps:此时,只能在本域中发送邮件;若要实现向外域发送邮件的功能,在DNS配置文件中添加转发即可。