Windows XP Windows 7 Windows 2003 Windows Vista Windows教程綜合 Linux 系統教程
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟件教程
 Windows教程網 >> 電腦軟件教程 >> 服務器技術 >> 郵件服務器 >> postfix+extmail搭建web郵件服務器

postfix+extmail搭建web郵件服務器

日期:2017/1/21 9:55:34      編輯:郵件服務器

一、安裝前的准備工作

1、修改本地參數

修改服務器ip地址以及DNS服務器,本次實驗為了節約資源采用本機的DNS服務器。

122333688.png

122428537.png

2、使用本地光盤資源,修改yum源配置文件,避免軟件包的依賴關系。

[root@localhost ~]# mkdir /mnt/cdrom //創建光盤掛載點

[root@localhost~]# mount /dev/cdrom /mnt/cdrom //掛載光盤到掛載點

mount: block device /dev/cdrom is write-protected, mountingread-only

[root@localhost~]# vim /etc/yum.repos.d/rhel-debuginfo.repo //修改yum配置文件中yum源為本地光盤

[rhel-Server]

name=Red HatEnterprise Linux Server

baseurl=file:///mnt/cdrom/Server

enabled=1

gpgcheck=1

gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release

3、配置本地DNS服務器,安裝bind及組件。

[root@localhost~]# yum install bind bind-chroot caching-nameserver //使用yum安裝更好地解決依賴關系

Loaded plugins:rhnplugin, security

This system isnot registered with RHN.

RHN support willbe disabled.

Setting upInstall Process

ResolvingDependencies

-> Running transaction check

---> Packagebind.i386 30:9.3.6-4.P1.el5 set to be updated

---> Packagebind-chroot.i386 30:9.3.6-4.P1.el5 set to be updated

---> Packagecaching-nameserver.i386 30:9.3.6-4.P1.el5 set to be updated

--> FinishedDependency Resolution

[root@localhost~]# cd /var/named/chroot/etc

[root@localhostetc]# ll

total 16

-rw-r--r-- 1root root 405 Jul 10 17:22 localtime

-rw-r----- 1root named 1230 Jul 30 2009named.caching-nameserver.conf

-rw-r----- 1root named 955 Jul 30 2009 named.rfc1912.zones

-rw-r----- 1root named 113 Sep 8 12:17 rndc.key

[root@localhostetc]# cp –p named.caching nameserver.conf named.conf //復制樣例配置文件並命名為named.conf

122855512.png

122904723.png

[root@localhostetc]# cd ../var/named/

[root@localhostnamed]# cp -p localhost.zone a.com.zone //復制本地域的樣例文件並進行修改成為a.com域文件

[root@localhostnamed]# vim a.com.zone

$TTL 86400

@ IN SOA ns.a.com. root (

42 ; serial (d. adams)

3H ; refresh

15M ; retry

1W ; expiry

1D) ; minimum

IN NS ns.a.com.

ns IN A 192.168.3.100

mail IN A 192.168.3.100

pop3 IN CNAME mail

smtp IN CNAME mail

@ IN MX 10 mail

[root@localhost~]# service named start //啟動DNS服務

Startingnamed: [ OK ]

[root@localhost~]# tail -f /var/log/messages //查看日志可以看到DNS服務已經運行

Sep 9 06:02:40 localhost named[3617]: commandchannel listening on ::1#953

Sep 9 06:02:40 localhost named[3617]: the workingdirectory is not writable

Sep 9 06:02:40 localhost named[3617]: zone0.inaddr.arpa/IN/localhost_resolver: loaded serial 42

Sep 9 06:02:40 localhost named[3617]: zone0.0.127.inaddr.arpa/IN/localhost_resolver: loaded serial 1997022700

Sep 9 06:02:40 localhost named[3617]: zone255.inaddr.arpa/IN/localhost_resolver: loaded serial 42

Sep 9 06:02:40 localhost named[3617]: zone0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN/localhost_resolver:loaded serial 1997022700

Sep 9 06:02:40 localhost named[3617]: zonea.com/IN/localhost_resolver: loaded serial 42

Sep 9 06:02:40 localhost named[3617]: zonelocaldomain/IN/localhost_resolver: loaded serial 42

Sep 9 06:02:40 localhost named[3617]: zonelocalhost/IN/localhost_resolver: loaded serial 42

Sep 9 06:02:40 localhost named[3617]: running

[root@localhost~]# chkconfig named on //設置DNS服務開機啟動

[root@localhost~]# vim /etc/sysconfig/network //修改服務器的主機名

NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=mail.a.com

[root@localhost~]# hostname mail.a.com //一般修改過主機名需要重啟才能生效,這裡就手工設置一個,重新登錄即可

[root@mail ~]#hostname

mail.a.com

[root@mail ~]#dig mail.a.com //測試能否解析mail.a.com

;<<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5 <<>> mail.a.com

;; globaloptions: printcmd

;; Got answer:

;;->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18744

;; flags: qr aard ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTIONSECTION:

;mail.a.com. IN A

;; ANSWERSECTION:

mail.a.com. 86400 IN A 192.168.3.100

;; AUTHORITYSECTION:

a.com. 86400 IN NS ns.a.com.

;; ADDITIONALSECTION:

ns.a.com. 86400 IN A 192.168.3.100

;; Query time: 1msec

;; SERVER:192.168.3.100#53(192.168.3.100)

;; WHEN: MonSep 9 06:09:56 2013

;; MSG SIZE rcvd: 77

[root@mail ~]#dig -t mx a.com //測試DNS解析

;<<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5 <<>> -t mxa.com

;; globaloptions: printcmd

;; Got answer:

;;->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37558

;; flags: qr aard ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; QUESTIONSECTION:

;a.com. IN MX

;; ANSWERSECTION:

a.com. 86400 IN MX 10 mail.a.com.

;; AUTHORITYSECTION:

a.com. 86400 IN NS ns.a.com.

;; ADDITIONALSECTION:

mail.a.com. 86400 IN A 192.168.3.100

ns.a.com. 86400 IN A 192.168.3.100

;; Query time: 1msec

;; SERVER:192.168.3.100#53(192.168.3.100)

;; WHEN: MonSep 9 06:11:08 2013

;; MSG SIZE rcvd: 93

安裝postfix之前的准備工作

[root@mail ~]# yum install httpd mysql mysql-server mysql-devel openssl-devel dovecot perl-DBD-MySQL tcl tcl-devel libart_lgpl libart_lgpl-devel libtool-ltdl libtool-ltdl-devel expect //yum安裝httpd、mysql、dovecot以及相關組件

[root@mail postfix-2.8.2]# service httpdstart //啟動httpd服務並查看80端口是否打開

[root@mail postfix-2.8.2]# netstat -tupln|grep httpd

tcp 0 0 :::80 :::* LISTEN 3215/httpd

[root@mail postfix-2.8.2]# chkconfig httpdon //設置httpd服務為開機啟動

[root@mail postfix-2.8.2]# service mysqldstart //啟動mysqld服務並設置為開機啟動

[root@mail postfix-2.8.2]# chkconfig mysqldon

root@mail postfix-2.8.2]# mysqladmin -uroot -p password 'redhat' //使用root用戶登錄並設置用戶密碼為“redhat”

Enter password:

mysql> select user,host from user; //從user表查看user、host字段

+------+------------+

| user | host |

+------+------------+

| root | 127.0.0.1 |

| | localhost |

| root | localhost |

| | mail.a.com |

| root | mail.a.com |

+------+------------+

5 rows in set (0.00 sec)

mysql> grant all privileges on *.* toroot@'%' identified by 'redhat'; //添加在別的主機訪問本機mysql的權限

Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges; //刷新設置並啟用

Query OK, 0 rows affected (0.00 sec)

mysql> select user,host from user; //再次查看user表的相關字段

+------+------------+

| user | host |

+------+------------+

| root | % |

| root | 127.0.0.1 |

| | localhost |

| root | localhost |

| | mail.a.com |

| root | mail.a.com |

+------+------------+

6 rows in set (0.00 sec)

二、安裝配置postfix

1、安裝postfix

[root@mail ~]#ll //上傳用到的源碼包

drwxr-xr-x 2root root 4096 Sep 9 06:18 postfix

[root@mailpostfix]# ll //查看搭建郵件服務器用到的所有源碼包

total 6916

-rw-r--r-- 1root root 13738 Sep 9 06:18 Unix-Syslog-1.1.tar.gz //日志補丁,可有可無,但沒它會報錯

-rw-r--r-- 1root root 2268626 Sep 9 06:18courier-authlib-0.63.1.20111230.tar.bz2 //結合mysql數據庫驗證的程序軟件包

-rw-r--r-- 1root root 541279 Sep 9 06:18 extmail-1.2.tar.gz //實現web頁面

-rw-r--r-- 1root root 586234 Sep 9 06:18 extman-1.1.tar.gz //實現郵箱注冊功能的

-rw-r--r-- 1root root 3644570 Sep 9 06:18postfix-2.8.2.tar.gz

[root@mail ~]#yum grouplist //postfix安裝需要四個普通的編譯開發環境,可以通過查看安裝的環境

[root@mailpostfix]# tar -zxvf postfix-2.8.2.tar.gz -C /usr/local/src/ //拆解軟件包到指定路徑

[root@mailpostfix]# cd /usr/local/src/postfix-2.8.2/

[[email protected]]# ls //查看拆解得到的內容

AAAREADME README_FILES RELEASE_NOTES-2.7 implementation-notes

COMPATIBILITY RELEASE_NOTES TLS_ACKNOWLEDGEMENTS include

COPYRIGHT RELEASE_NOTES-1.0 TLS_CHANGES lib

HISTORY RELEASE_NOTES-1.1 TLS_LICENSE libexec

INSTALL RELEASE_NOTES-2.0 TLS_TODO makedefs

IPv6-ChangeLog RELEASE_NOTES-2.1 US_PATENT_6321267 man

LICENSE RELEASE_NOTES-2.2 auxiliary mantools

Makefile RELEASE_NOTES-2.3 bin pflogsumm-conn-delays-dsn-patch

Makefile.in RELEASE_NOTES-2.4 conf postfix-install

Makefile.init RELEASE_NOTES-2.5 examples proto

PORTING RELEASE_NOTES-2.6 html

[root@mail postfix-2.8.2]# groupadd -g 2525 postfix //創建id=2525的postfix組

[[email protected]]# useradd -g postfix -u 2525 -s /sbin/nologon -M postfix //創建postfix用戶到postfix組,不創建家目錄

[[email protected]]# groupadd -g 2526 postdrop //創建id=2526的postdrop組

[[email protected]]# useradd -g postdrop -u 2526 -s /bin/false -M postdrop //創建postdrop用戶到postdrop組,不創建家目錄

[[email protected]]# 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'

//通過添加相關參數生成makefile文件

[[email protected]]# make //編譯並安裝postfix

[[email protected]]# make install

按照以下的提示輸入相關的路徑([]號中的是缺省值,”]”後的是輸入值,省略的表示采用默認值)

 

install_root: [/] / //安裝目錄

tempdir:[/usr/local/src/ postfix-2.6.5] /tmp //指定臨時目錄

config_directory:[/etc/postfix] /etc/postfix //指定配置文件存放目錄

command_directory:[/usr/sbin] //指定管理員二進制文件存放目錄

daemon_directory:[/usr/libexec/postfix] //指定模塊存放目錄

queue_directory:[/var/spool/postfix]

sendmail_path:[/usr/sbin/sendmail]

newaliases_path:[/usr/bin/newaliases]

mailq_path:[/usr/bin/mailq] //指定mailq二進制文件存放目錄

mail_owner:[postfix]

setgid_group:[postdrop]

html_directory: [no] /var/www/postfix_html

manpages: [/usr/local/man] //指定man手冊存放目錄

readme_directory: [no] //不創建readme目錄

生成別名二進制文件,這個步驟如果忽略,會造成postfix效率極低:

2、postfix基本配置,測試啟動postfix並進行收發郵件。

[[email protected]]# ll /usr/sbin/postfix

-rwxr-xr-x 1root root 284235 Oct 5 13:17/usr/sbin/postfix

[[email protected]]# file /usr/sbin/postfix

/usr/sbin/postfix:ELF 32bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9,dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

[[email protected]]# mkdir /tmp/abc //在臨時目錄下創建abc目錄

[[email protected]]# cd /tmp/abc //切換到abc目錄下

root@mail abc]#cp /mnt/cdrom/Server/postfix-2.3.3-2.1.el5_2.i386.rpm ./ //拷貝光盤上postfix的軟件包到當前目錄

[root@mail abc]#rpm2cpio postfix-2.3.3-2.1.el5_2.i386.rpm |cpio –id //拆解提取rpm軟件包中的所有內容

16333 blocks

[root@mail abc]#ll

total 3664

drwxr-xr-x 5root root 4096 Oct 10 10:36 etc

-r--r--r-- 1root root 3734257 Oct 10 10:36 postfix-2.3.3-2.1.el5_2.i386.rpm

drwxr-xr-x 7root root 4096 Oct 10 10:36 usr

drwxr-xr-x 3root root 4096 Oct 10 10:36 var

[root@mail abc]#cd etc/rc.d/init.d/

[[email protected]]# ll

total 4

-rwxr-xr-x 1root root 2404 Oct 10 10:36 postfix

[[email protected]]# cp -p postfix /etc/init.d/ //拷貝rpm軟件包提取的postfix控制腳本到系統服務目錄下

[[email protected]]# service postfix start //啟動postfix服務並查看25端口是否打開

Startingpostfix: [ OK ]

[[email protected]]# netstat -tupln |grep 25

tcp 0 00.0.0.0:25 0.0.0.0:* LISTEN 3966/master

[[email protected]]# chkconfig postfix on //將postfix服務加入開機啟動項

[[email protected]]# vim /etc/postfix/main.cf

說明:

myorigin參數用來指明發件人所在的域名;

mydestination參數指定postfix接收郵件時收件人的域名,即您的postfix系統要接收到哪個域名的郵件;

myhostname 參數指定運行postfix郵件系統的主機的主機名,默認情況下,其值被設定為本地機器名;

mydomain參數指定您的域名,默認情況下,postfix將myhostname的第一部分刪除而作為mydomain的值;

mynetworks 參數指定你所在的網絡的網絡地址,postfix系統根據其值來區別用戶是遠程的還是本地的,如果是本地網絡用戶則允許其訪問;

inet_interfaces 參數指定postfix系統監聽的網絡接口;

注意:

1、在postfix的配置文件中,參數行和注釋行是不能處在同一行中的;

2、任何一個參數的值都不需要加引號,否則,引號將會被當作參數值的一部分來使用;

3、每修改參數及其值後執行postfix reload 即可令其生效;但若修改了inet_interfaces,則需重新啟動postfix;

4、如果一個參數的值有多個,可以將它們放在不同的行中,只需要在其後的每個行前多置一個空格即可;postfix會把第一個字符為空格或tab的文本行視為上一行的延續;

123146456.png

123201893.png

123214401.png

[[email protected]]# service postfix restart //重啟postfix服務

Shutting downpostfix: [ OK ]

Startingpostfix: [ OK ]

[[email protected]]# useradd user1 //添加本地賬戶user1

[[email protected]]# passwd user1

Changingpassword for user user1.

New UNIXpassword:

BAD PASSWORD: itis WAY too short

Retype new UNIXpassword:

passwd: allauthentication tokens updated successfully.

[root@mail ~]#telnet 127.0.0.1 25 //使用user1用戶向root用戶發送郵件,驗證postfix服務是否正常運行

Trying127.0.0.1...

Connected tolocalhost.localdomain (127.0.0.1).

Escape characteris '^]'.

220 mail.a.comESMTP Postfix

ehlo mail.a.com

250-mail.a.com

250-PIPELINING

250-SIZE10240000

250-VRFY

250-ETRN

250-ENHANCEDSTATUSCODES

250-8BITMIME

250 DSN

mailfrom:[email protected]

250 2.1.0 Ok

rcptto:[email protected]

250 2.1.5 Ok

data

354 End datawith <CR><LF>.<CR><LF>

subject:1

1111111

.

250 2.0.0 Ok:queued as CBC1A13CAA8

quit

221 2.0.0 Bye

Connectionclosed by foreign host.

You have newmail in /var/spool/mail/root

[root@mail ~]#tail -f /var/log/maillog //查看郵件日志

Oct 10 11:19:12mail postfix/smtpd[4315]: warning: dict_nis_init: NIS domain name not set - NISlookups disabled

Oct 10 11:19:12mail postfix/smtpd[4315]: connect from localhost.localdomain[127.0.0.1]

Oct 10 11:20:06mail postfix/smtpd[4315]: CBC1A13CAA8: client=localhost.localdomain[127.0.0.1]

Oct 10 11:20:37mail postfix/cleanup[4182]: CBC1A13CAA8:message-id=<[email protected]>

Oct 10 11:20:37mail postfix/qmgr[4107]: CBC1A13CAA8: from=<[email protected]>, size=312,nrcpt=1 (queue active)

Oct 10 11:20:37mail postfix/local[4368]: warning: dict_nis_init: NIS domain name not set - NISlookups disabled

Oct 10 11:20:37mail postfix/local[4368]: CBC1A13CAA8: to=<[email protected]>, relay=local,delay=63, delays=63/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to mailbox)

Oct 10 11:20:37mail postfix/qmgr[4107]: CBC1A13CAA8: removed

Oct 10 11:20:44mail postfix/smtpd[4315]: disconnect from localhost.localdomain[127.0.0.1]

[root@mail ~]#mail //查看本地收到的郵件

Mail version 8.16/6/93. Type ? for help.

"/var/spool/mail/root":4 messages 4 new

>N 1 [email protected] Sat Oct 5 11:19 43/1521 "Logwatch for mail.a.com (Linux)"

N [email protected] Sat Oct 5 12:24 43/1510 "Logwatch formail.a.com (Linux)"

N [email protected] Thu Oct 1011:18 41/1372 "Logwatch for mail.a.com (Linux)"

N [email protected] Thu Oct 1011:20 14/425 "1"

& 4

Message 4:

[email protected] Thu Oct 10 11:20:37 2013

X-Original-To:[email protected]

Delivered-To:[email protected]

subject:1

Date: Thu, 10Oct 2013 11:19:34 +0800 (CST)

From:[email protected]

1111111

& q

Saved 1 messagein mbox

三、為postfix開啟基於cyrus-sasl的認證功能

[root@mail ~]#rpm -qa |grep sasl //查詢有關sasl的軟件包是否安裝

cyrus-sasl-lib-2.1.22-5.el5

cyrus-sasl-2.1.22-5.el5

cyrus-sasl-devel-2.1.22-5.el5

cyrus-sasl-plain-2.1.22-5.el5

[root@mail ~]#cd /usr/lib/sasl2/

[root@mailsasl2]# ll

total 1024

-rw-r--r-- 1root root 25 Nov 28 2006 Sendmail.conf

-rwxr-xr-x 1root root 864 Apr 28 2009 libanonymous.la

lrwxrwxrwx 1root root 22 Jul 11 01:02libanonymous.so -> libanonymous.so.2.0.22

lrwxrwxrwx 1root root 22 Jul 11 01:02libanonymous.so.2 -> libanonymous.so.2.0.22

-rwxr-xr-x 1root root 14372 Apr 28 2009 libanonymous.so.2.0.22

-rwxr-xr-x 1root root 836 Apr 28 2009 liblogin.la

lrwxrwxrwx 1root root 18 Jul 11 01:03 liblogin.so-> liblogin.so.2.0.22

lrwxrwxrwx 1root root 18 Jul 11 01:03liblogin.so.2 -> liblogin.so.2.0.22

-rwxr-xr-x 1root root 14752 Apr 28 2009 liblogin.so.2.0.22

-rwxr-xr-x 1root root 836 Apr 28 2009 libplain.la

lrwxrwxrwx 1root root 18 Jul 11 01:03 libplain.so-> libplain.so.2.0.22

lrwxrwxrwx 1root root 18 Jul 11 01:03libplain.so.2 -> libplain.so.2.0.22

-rwxr-xr-x 1root root 14848 Apr 28 2009 libplain.so.2.0.22

-rwxr-xr-x 1root root 910 Apr 28 2009 libsasldb.la

lrwxrwxrwx 1root root 19 Jul 11 01:04libsasldb.so -> libsasldb.so.2.0.22

lrwxrwxrwx 1root root 19 Jul 11 01:04libsasldb.so.2 -> libsasldb.so.2.0.22

-rwxr-xr-x 1root root 905200 Apr 28 2009libsasldb.so.2.0.22

[root@mailsasl2]# cp -p Sendmail.conf smtpd.conf //將sendmail的配置文件復制到sasl下並命名為smtpd.conf

[root@mailsasl2]# vim smtpd.conf //編寫smtpd配置文件

pwcheck_method:saslauthd

[root@mailsasl2]# service saslauthd start //啟動sasl驗證服務並設置為開機啟動

Startingsaslauthd: [ OK ]

[root@mailsasl2]# chkconfig saslauthd on

[root@mailsasl2]# vim /etc/postfix/main.cf //編寫postfix配置文件為postfix添加sasl驗證功能

配置文件最後添加如下內容:

############################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

smtpd_sasl_auth_enable= yes

smtpd_sasl_local_domain= $myhostname

smtpd_sasl_security_options= noanonymous

smtpd_banner =Welcome to our $myhostname ESMTP,Warning: Version not Available!

[root@mailsasl2]# service postfix restart //postfix服務重啟

Shutting downpostfix: [ OK ]

Startingpostfix: [ OK ]

[root@mailsasl2]# telnet 127.0.0.1 25

Trying127.0.0.1...

Connected tolocalhost.localdomain (127.0.0.1).

Escape characteris '^]'.

220 Welcome toour mail.a.com ESMTP,Warning: Version not Available!

ehlo ,mail.a.com

250-mail.a.com

250-PIPELINING

250-SIZE10240000

250-VRFY

250-ETRN

250-AUTH PLAINLOGIN //已經啟用身份驗證

250-AUTH=PLAINLOGIN

250-ENHANCEDSTATUSCODES

250-8BITMIME

250 DSN

quit

221 2.0.0 Bye

Connectionclosed by foreign host.

四、安裝Courierauthentication library

[root@mail ~]#cd postfix/

[root@mailpostfix]# ll

total 6916

-rw-r--r-- 1root root 13738 Oct 3 18:36 Unix-Syslog-1.1.tar.gz

-rw-r--r-- 1root root 2268626 Oct 3 18:36courier-authlib-0.63.1.20111230.tar.bz2

-rw-r--r-- 1root root 541279 Oct 3 18:36 extmail-1.2.tar.gz

-rw-r--r-- 1root root 586234 Oct 3 18:36 extman-1.1.tar.gz

-rw-r--r-- 1root root 3644570 Oct 3 18:36postfix-2.8.2.tar.gz

[root@mailpostfix]# tar jxvf courier-authlib-0.63.1.20111230.tar.bz2 -C /usr/local/src/

[root@mailpostfix]# cd /usr/local/src/courier-authlib-0.63.1.20111230/

[[email protected]]# ./configure \

>--prefix=/usr/local/courier-authlib \ //指定安裝目錄

>sysconfdir=/etc \ //指定配置文件存放目錄

>--with-authmysql \ //使用mysql數據庫中的數據進行身份驗證

> --with-mysql-libs=/usr/lib/mysql \ //mysql庫文件存放路徑

> --with-mysql-includes=/usr/include/mysql \ //mysql頭文件存放路徑

>--with-redhat \ //redhat

>--with-authmysqlrc=/etc/authmysqlrc \ //指定驗證說明文件存放目錄

>--with-authdaemonrc=/etc/authdaemonrc \ //指定模塊調用說明文件目錄

>--with-ltdl-lib=/usr/lib \ //額外添加的參數,否則報錯

>--with-ltdl-include=/usr/include //額外添加的參數,否則報錯

[[email protected]]# make && make install //編譯並安裝

[root@mailcourier-authlib]# echo"/usr/local/courier-authlib/lib/courier-authlib/" >>/etc/ld.so.conf.d/courier-authlib.conf //輸出重定向courier-authlib目錄到配置文件中

[root@mailcourier-authlib]# ldconfig //刷新系統庫文件緩存

[root@mailcourier-authlib]# ldconfig -pv |grep courier //查看courier相關庫緩存

libcourierauthsaslclient.so (libc6) =>/usr/local/courier-authlib/lib/courier-authlib/libcourierauthsaslclient.so

libcourierauthsasl.so (libc6) =>/usr/local/courier-authlib/lib/courier-authlib/libcourierauthsasl.so

libcourierauthcommon.so (libc6) =>/usr/local/courier-authlib/lib/courier-authlib/libcourierauthcommon.so

libcourierauth.so (libc6) =>/usr/local/courier-authlib/lib/courier-authlib/libcourierauth.so

libauthuserdb.so (libc6) =>/usr/local/courier-authlib/lib/courier-authlib/libauthuserdb.so

libauthpipe.so (libc6) =>/usr/local/courier-authlib/lib/courier-authlib/libauthpipe.so

libauthpam.so (libc6) =>/usr/local/courier-authlib/lib/courier-authlib/libauthpam.so

libauthmysql.so (libc6) =>/usr/local/courier-authlib/lib/courier-authlib/libauthmysql.so

libauthldap.so (libc6) =>/usr/local/courier-authlib/lib/courier-authlib/libauthldap.so

libauthcustom.so (libc6) =>/usr/local/courier-authlib/lib/courier-authlib/libauthcustom.so

[root@mailcourier-authlib]# ln -s /usr/local/courier-authlib/include//usr/include/courier-authlib //將courier-authlib頭文件鏈接到系統頭文件目錄

[root@mailcourier-authlib]# netstat -tupln |grep mysql

tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 3018/mysqld

[root@mail ~]#chmod 755 /usr/local/courier-authlib/var/spool/authdaemon //修改權限

[root@mail ~]#cp /etc/authdaemonrc.dist /etc/authdaemonrc //復制樣例文件並重命名

[root@mail ~]#cp /etc/authmysqlrc.dist /etc/authmysqlrc

[root@mail ~]#vim /etc/authdaemonrc //編輯修改驗證方式配置文件

123348377.png

[root@mail ~]#vim /etc/authmysqlrc //編輯修改數據庫驗證配置文件的mysql相關參數

123521424.png

123532424.png

123555426.png

123614253.png

123643970.png

123648412.png

[root@mail ~]#cd /usr/local/src/courier-authlib-0.63.1.20111230/

[[email protected]]# ll |grep init

-rw-r--r-- 1root root 943 Oct 10 13:14courier-authlib.sysvinit

-rw-rw-r-- 11000 1000 892 May 25 2011 courier-authlib.sysvinit.in

[[email protected]]# cd /etc/init.d/

[[email protected]]# chmod a+x courier-authlib //賦予執行權限

[[email protected]]# service courier-authlib start //驗證服務打開

Starting Courierauthentication services: authdaemond

[[email protected]]# chkconfig courier-authlib on //設置開機啟動

[[email protected]]# mkdir -pv /var/mailbox //創建郵箱基目錄

mkdir: createddirectory `/var/mailbox'

[[email protected]]# ll -d /var/mailbox/

drwxr-xr-x 2root root 4096 Oct 17 07:01 /var/mailbox/

[[email protected]]# chown -R postfix:postfix /var/mailbox/ //修改郵箱基目錄的所屬組

[[email protected]]# ll -d /var/mailbox/

drwxr-xr-x 2postfix postfix 4096 Oct 17 07:01 /var/mailbox/

[[email protected]]# vim /usr/lib/sasl2/smtpd.conf //編寫smtpd配置文件配置驗證功能

pwcheck_method:authdaemond

log_level: 3

mech_list:PLAINLOGIN

authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket

[[email protected]]# service saslauthd restart //重啟saslauthd服務

Stoppingsaslauthd: [ OK ]

Startingsaslauthd: [ OK ]

[[email protected]]# service courier-authlib restart //重啟courier-authlib服務

Stopping Courierauthentication services: authdaemond

Starting Courierauthentication services: authdaemond

五、配置postfix支持虛擬域和虛擬用戶

1、編輯/etc/postfix/main/cf,添加如下內容

[[email protected]]# vim /etc/postfix/main.cf //追加如下內容

########################VirtualMailbox 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:2525

virtual_gid_maps= static:2525

virtual_transport= virtual

maildrop_destination_recipient_limit= 1

maildrop_destination_concurrency_limit= 1

##########################QUOTASettings########################

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 yourmailbox and try again later.

virtual_overquota_bounce= yes

2、使用extman源碼目錄下docs目錄中的extmail.sql和init.sql建立數據庫

[root@mail docs]# mysql -u root -p<extmail.sql

Enter password:

[root@maildocs]# mysql -u root -p <init.sql

Enter password:

[root@maildocs]# mysql -u root -p //登錄mysql服務器查看導入的數據庫

Enter password:

Welcome to theMySQL monitor. Commands end with ; or\g.

Your MySQLconnection id is 4

Server version:5.0.77 Source distribution

Type 'help;' or'\h' for help. Type '\c' to clear the buffer.

mysql> showdatabases;

+--------------------+

| Database |

+--------------------+

|information_schema |

| extmail |

| mysql |

| test |

+--------------------+

4 rows in set(0.04 sec)

mysql> use extmail;

Reading tableinformation for completion of table and column names

You can turn offthis feature to get a quicker startup with -A

Database changed

mysql> show tables;

+-------------------+

|Tables_in_extmail |

+-------------------+

| alias |

| domain |

|domain_manager |

| mailbox |

| manager |

+-------------------+

5 rows in set(0.00 sec)

3、授予用戶extmail訪問extmail數據庫的權限

mysql> grantall privileges on extmail.* to extmail@localhost identified by 'extmail';

Query OK, 0 rowsaffected (0.00 sec) //授予用戶extmail訪問extmail數據庫的權限

mysql> flushprivileges;

Query OK, 0 rowsaffected (0.00 sec) //刷新設置,使設置生效

root@mail ~]# cdpostfix/extman-1.1/docs/

[root@maildocs]# ll

total 76

-rw-r--r-- 1 500500 1337 Dec 16 2005 README.postfix

-rw-r--r-- 1 500500 1250 Apr 23 2006 backport

-rw-r--r-- 1 500500 11180 Feb 28 2007 extmail.schema

-rw-r--r-- 1 500500 5141 Mar 30 2008 extmail.sql

-rw-r--r-- 1 500500 2671 Mar 19 2008 init.ldif

-rw-r--r-- 1 500500 1478 Apr 4 2008init.sql

-rw-r--r-- 1 500500 201 Apr 24 2006 ldap_virtual_alias_maps.cf

-rw-r--r-- 1 500500 210 Dec 15 2005 ldap_virtual_domains_maps.cf

-rw-r--r-- 1 500500 195 Dec 15 2005 ldap_virtual_limit_maps.cf

-rw-r--r-- 1 500500 202 Nov 4 2005ldap_virtual_mailbox_maps.cf

-rw-r--r-- 1 500500 190 Mar 7 2007ldap_virtual_sender_maps.cf

-rw-r--r-- 1 500500 166 Dec 15 2005 mysql_virtual_alias_maps.cf

-rw-r--r-- 1 500500 168 Feb 25 2007 mysql_virtual_domains_maps.cf

-rw-r--r-- 1 500500 170 Dec 15 2005 mysql_virtual_limit_maps.cf

-rw-r--r-- 1 500500 172 Dec 15 2005 mysql_virtual_mailbox_maps.cf

-rw-r--r-- 1 500500 173 Mar 7 2007mysql_virtual_sender_maps.cf

[root@maildocs]# cp mysql* /etc/postfix/ //前面postfix配置文件引用到數據庫相關域的配置文件,復制數據庫相關域的配置文件到postfix目錄下

[root@maildocs]# cd /etc/postfix/

[root@mailpostfix]# ll

total 212

-rw-r--r-- 1root root 11942 Oct 5 13:17 LICENSE

-rw-r--r-- 1root root 1629 Oct 5 13:17 TLS_LICENSE

-rw-r--r-- 1root root 20876 Oct 5 13:17 access

-rw-r--r-- 1root root 8829 Oct 5 13:17 aliases

-rw-r--r-- 1root root 3548 Oct 5 13:17 bounce.cf.default

-rw-r--r-- 1root root 11681 Oct 5 13:17 canonical

-rw-r--r-- 1root root 9904 Oct 5 13:17 generic

-rw-r--r-- 1root root 21535 Oct 5 13:17header_checks

-rw-r--r-- 1root root 7896 Oct 17 07:14 main.cf

-rw-r--r-- 1root root 27397 Oct 5 13:17main.cf.default

-rw-r--r-- 1root root 779 Oct 5 13:17 makedefs.out

-rw-r--r-- 1root root 5695 Oct 5 13:17 master.cf

-rw-r--r-- 1root root 166 Oct 17 12:22mysql_virtual_alias_maps.cf

-rw-r--r-- 1root root 168 Oct 17 12:22mysql_virtual_domains_maps.cf

-rw-r--r-- 1root root 170 Oct 17 12:22mysql_virtual_limit_maps.cf

-rw-r--r-- 1root root 172 Oct 17 12:22 mysql_virtual_mailbox_maps.cf

-rw-r--r-- 1root root 173 Oct 17 12:22mysql_virtual_sender_maps.cf

-rw-r--r-- 1root root 6816 Oct 5 13:17 relocated

-rw-r--r-- 1root root 12549 Oct 5 13:17 transport

-rw-r--r-- 1root root 12494 Oct 5 13:17 virtual

六、配置dovecot

[root@mailpostfix]# rpm -qa |grep dovecot

dovecot-1.0.7-7.el5

[root@mailpostfix]# vim /etc/dovecot.conf //配置dovecot配置文件

123916362.png

123943279.png

124001910.png

124516178.png

[root@mailextmail]# vim /etc/postfix/main.cf

現在我們啟動dovecot服務會報錯,因為我們還沒有產生dovecot與mysql結合的配置文件

[root@mail ~]#vim /etc/dovecot-mysql.conf //填寫如下內容

driver = mysql //mysql驅動

connect =host=localhost dbname=extmail user=extmail password=extmail (如mysql源碼安裝,host=/tmp/mysql.sock) //連接數據庫參數

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'

[root@mail ~]#service dovecot start

Starting DovecotImap: [ OK ]

[root@mail ~]#service dovecot restart

Stopping DovecotImap: [ OK ]

Starting DovecotImap: [ OK ]

七、安裝Extmail-1.2 (需先安裝httpd)

1、安裝

[root@mail ~]#cd postfix/

[root@mailpostfix]# ll

total 6920

-rw-r--r-- 1 root root 13738 Oct 3 18:36Unix-Syslog-1.1.tar.gz

-rw-r--r-- 1 root root 2268626 Oct 3 18:36courier-authlib-0.63.1.20111230.tar.bz2

-rw-r--r-- 1 root root 541279 Oct 3 18:36extmail-1.2.tar.gz

drwxr-xr-x11 500 500 4096 Dec 24 2009 extman-1.1

-rw-r--r-- 1 root root 586234 Oct 3 18:36extman-1.1.tar.gz

-rw-r--r-- 1 root root 3644570 Oct 3 18:36 postfix-2.8.2.tar.gz

[root@mail postfix]#tar zxvf extmail-1.2.tar.gz

[root@mailpostfix]# mkdir -pv /var/www/extsuite

mkdir: createddirectory `/var/www/extsuite'

[root@mailpostfix]# mv extmail-1.2 /var/www/extsuite/extmail

[root@mailpostfix]# mv extman-1.1 /var/www/extsuite/extman

[root@mailpostfix]# cd /var/www/extsuite/extmail/

[root@mailextmail]# ll

total 168

-rw-r--r-- 1 500500 410 Jan 26 2007 AUTHORS

-rw-r--r-- 1 500500 900 Feb 20 2006 CREDITS

-rw-r--r-- 1 500500 61170 Dec 18 2009 ChangeLog

-rw-r--r-- 1 500500 1305 Oct 9 2007FAQ

-rw-r--r-- 1 500500 3728 Feb 24 2008 INSTALL

-rw-r--r-- 1 500500 2771 Nov 7 2009README

-rw-r--r-- 1 500500 12677 Oct 13 2008 README.fcgi

-rw-r--r-- 1 500500 1263 Nov 7 2009README.filter

-rw-r--r-- 1 500500 2281 Feb 15 2007 README.vpopmail

-rw-r--r-- 1 500500 4 Dec 25 2009 Version

drwxr-xr-x 2 500500 4096 Nov 7 2009cgi

-rwxr-xr-x 1 500500 1743 Nov 7 2009dispatch-init

-rwxr-xr-x 1 500500 14477 Nov 7 2009 dispatch.fcgi

-rwxr-xr-x 1 500500 234 Oct 9 2007dispatch_lig.sh

-rw-r--r-- 1 500500 90 Jun 9 2008globabook.cf

drwxr-xr-x 5 500500 4096 Oct 9 2007html

drwxr-xr-x 2 500500 4096 Dec 18 2009 lang

drwxr-xr-x 7 500500 4096 Nov 10 2009 libs

drwxr-xr-x 2 500500 4096 Nov 7 2009tools

-rw-r--r-- 1 500500 6808 Dec 18 2009 webmail.cf.default

[root@mailextmail]# ll cgi/

total 44

-rwxr-xr-x 1 500500 649 Oct 5 2007abook.cgi

-rwxr-xr-x 1 500500 654 Apr 3 2009compose.cgi

-rwxr-xr-x 1 500500 1017 Oct 5 2007 env.cgi

-rwxr-xr-x 1 500500 653 Oct 5 2007filter.cgi

-rwxr-xr-x 1 500500 655 Nov 7 2009folders.cgi

-rwxr-xr-x 1 500500 667 Oct 5 2007globabook.cgi

-rwxr-xr-x 1 500500 646 Oct 7 2007index.cgi

-rwxr-xr-x 1 500500 655 Oct 5 2007netdisk.cgi

-rwxr-xr-x 1 500500 647 Oct 5 2007pref.cgi

-rwxr-xr-x 1 500500 655 Aug 8 2008readmsg.cgi

-rwxr-xr-x 1 500500 648 Apr 2 2009search.cgi

[root@mailextmail]# chown -R postfix:postfix cgi/ //修改目錄下所有文件的所屬主

[root@mailextmail]# ll cgi/

total 44

-rwxr-xr-x 1postfix postfix 649 Oct 5 2007abook.cgi

-rwxr-xr-x 1postfix postfix 654 Apr 3 2009compose.cgi

-rwxr-xr-x 1postfix postfix 1017 Oct 5 2007 env.cgi

-rwxr-xr-x 1postfix postfix 653 Oct 5 2007filter.cgi

-rwxr-xr-x 1postfix postfix 655 Nov 7 2009folders.cgi

-rwxr-xr-x 1postfix postfix 667 Oct 5 2007globabook.cgi

-rwxr-xr-x 1postfix postfix 646 Oct 7 2007index.cgi

-rwxr-xr-x 1postfix postfix 655 Oct 5 2007netdisk.cgi

-rwxr-xr-x 1postfix postfix 647 Oct 5 2007pref.cgi

-rwxr-xr-x 1postfix postfix 655 Aug 8 2008readmsg.cgi

-rwxr-xr-x 1postfix postfix 648 Apr 2 2009search.cgi

2、修改主配置文件

[root@mailextmail]# vim webmail.cf

124644851.png

124653626.png

124722969.png

124726163.png

[root@mailextmail]# service postfix restart //重啟所有相關服務

Shutting downpostfix: [ OK ]

Startingpostfix: [ OK ]

[root@mailextmail]# service dovecot restart

Stopping DovecotImap: [ OK ]

Starting DovecotImap: [ OK ]

[root@mailextmail]# service saslauthd restart

Stoppingsaslauthd: [ OK ]

Startingsaslauthd: [ OK ]

[root@mailextmail]# service courier-authlib restart

Stopping Courierauthentication services: authdaemond

Starting Courierauthentication services: authdaemond

3、apache相關配置

[root@mail ~]#vim /etc/httpd/conf/httpd.conf

124846835.png

由於extmail要進行本地郵件的投遞操作,故必須將運行apache服務器用戶的身份修改為您的郵件投遞代理的用戶;本例中打開了apache服務器的suexec功能,故使用以下方法來實現虛擬主機運行身份的指定。此例中的MDA為postfix自帶,因此將指定為postfix用戶:

<VirtualHost*:80>

ServerNamemail.test.com

DocumentRoot/var/www/extsuite/extmail/html/

ScriptAlias/extmail/cgi /var/www/extsuite/extmail/cgi

Alias /extmail/var/www/extsuite/extmail/html

</VirtualHost>

[root@mail ~]#service httpd restart

Stoppinghttpd: [ OK ]

Starting httpd:httpd: Could not reliably determine the server's fully qualified domain name,using mail.a.com for ServerNam [ OK ]

4、依賴關系的解決

[root@mail ~]#cd postfix/

[root@mailpostfix]# ll

total 6916

-rw-r--r-- 1root root 13738 Oct 3 18:36 Unix-Syslog-1.1.tar.gz

-rw-r--r-- 1root root 2268626 Oct 3 18:36courier-authlib-0.63.1.20111230.tar.bz2

-rw-r--r-- 1root root 541279 Oct 3 18:36 extmail-1.2.tar.gz

-rw-r--r-- 1root root 586234 Oct 3 18:36 extman-1.1.tar.gz

-rw-r--r-- 1root root 3644570 Oct 3 18:36postfix-2.8.2.tar.gz

[root@mailpostfix]# tar zxvf Unix-Syslog-1.1.tar.gz

[root@mailpostfix]# cd Unix-Syslog-1.1

[[email protected]]# perl Makefile.PL //使用perl語法獲得makefile文件

Checking if yourkit is complete...

Looks good

Writing Makefilefor Unix::Syslog

[[email protected]]# make

[[email protected]]# make install

這是我們可以打開郵箱的web頁面了,但是這個時候還不可以注冊郵箱,因為注冊郵箱需要調用extman的一些參數,我們需要將extman安裝配置。

125007947.png

八、安裝Extman-1.1

1、安裝及基本配置

[root@mail ~]#cd postfix/

[root@mailpostfix]# ll

total 6916

-rw-r--r-- 1root root 13738 Oct 3 18:36 Unix-Syslog-1.1.tar.gz

-rw-r--r-- 1root root 2268626 Oct 3 18:36courier-authlib-0.63.1.20111230.tar.bz2

-rw-r--r-- 1root root 541279 Oct 3 18:36 extmail-1.2.tar.gz

-rw-r--r-- 1root root 586234 Oct 3 18:36 extman-1.1.tar.gz

-rw-r--r-- 1root root 3644570 Oct 3 18:36postfix-2.8.2.tar.gz

[root@mailpostfix]# tar zxvf extman-1.1.tar.gz

[root@mailpostfix]# cd extman-1.1

[[email protected]]# cd docs/

[root@maildocs]# ll

total 76

-rw-r--r-- 1 500500 1337 Dec 16 2005 README.postfix

-rw-r--r-- 1 500500 1250 Apr 23 2006 backport

-rw-r--r-- 1 500500 11180 Feb 28 2007 extmail.schema

-rw-r--r-- 1 500500 5141 Mar 30 2008 extmail.sql

-rw-r--r-- 1 500500 2671 Mar 19 2008 init.ldif

-rw-r--r-- 1 500500 1478 Apr 4 2008init.sql

-rw-r--r-- 1 500500 201 Apr 24 2006 ldap_virtual_alias_maps.cf

-rw-r--r-- 1 500500 210 Dec 15 2005 ldap_virtual_domains_maps.cf

-rw-r--r-- 1 500500 195 Dec 15 2005 ldap_virtual_limit_maps.cf

-rw-r--r-- 1 500500 202 Nov 4 2005ldap_virtual_mailbox_maps.cf

-rw-r--r-- 1 500500 190 Mar 7 2007ldap_virtual_sender_maps.cf

-rw-r--r-- 1 500500 166 Dec 15 2005 mysql_virtual_alias_maps.cf

-rw-r--r-- 1 500500 168 Feb 25 2007 mysql_virtual_domains_maps.cf

-rw-r--r-- 1 500500 170 Dec 15 2005 mysql_virtual_limit_maps.cf

-rw-r--r-- 1 500500 172 Dec 15 2005 mysql_virtual_mailbox_maps.cf

-rw-r--r-- 1 500500 173 Mar 7 2007mysql_virtual_sender_maps.cf

[root@mailextman]# cp webman.cf.default webman.cf //拷貝樣例文件並重命名

[root@mailextman]# vim webman.cf

125118423.png

125129817.png

[root@mailextman]# chown -R postfix:postfix /var/www/extsuite/extman/cgi/ //修改目錄所屬主

[root@mailextman]# vim /etc/httpd/conf/httpd.conf

在配置文件中Extmail的虛擬主機部分,添加如下兩行:

ScriptAlias/extman/cgi /var/www/extsuite/extman/cgi

Alias /extman/var/www/extsuite/extman/html

好了,到此為止,重新啟動apache服務器後,您的Webmail和Extman已經可以使用了,可以在浏覽器中輸入指定的虛擬主機的名稱進行訪問。

選擇管理即可登入extman進行後台管理了。默認管理帳號為:[email protected] 密碼為:extmail*123*

說明:

(1) 如果您安裝後無法正常顯示校驗碼,安裝perl-GD模塊會解決這個問題。如果想簡單,您可以到以下地址下載適合您的平台的rpm包,安裝即可: http://dries.ulyssis.org/rpm/packages/perl-GD/info.html

(2) extman-1.1自帶了圖形化顯示日志的功能;此功能需要rrdtool的支持,您需要安裝此些模塊才可能正常顯示圖形日志。

[root@mailextman]# service httpd restart

Stoppinghttpd: [ OK ]

Starting httpd:httpd: Could not reliably determine the server's fully qualified domain name,using mail.a.com for ServerName [ OK ]

[root@mailextman]# mkdir -pv /tmp/extman

mkdir: createddirectory `/tmp/extman'

[root@mailextman]# chown -R postfix:postfix /tmp/extman/

125229754.png

125304885.png

125328746.png

mysql> select* from domain \G //查看domain域表中可以查看我們創建的兩個域

***************************1. row ***************************

domain: extmail.org

description: virtualDomain forextmail.org

hashdirpath: A0/B0

maxalias: 50

maxusers: 50

maxquota: 1073741824

maxnetdiskquota: 1073741824

transport: NULL

can_signup: 1

default_quota: 5242880

default_netdiskquota:5242880

default_expire: 1y

disablesmtpd: 0

disablesmtp: 0

disablewebmail: 0

disablenetdisk: 0

disableimap: 1

disablepop3: 0

createdate: 2007-02-14 15:10:04

expiredate: 2010-11-08

active: 1

***************************2. row ***************************

domain: a.com

description: 虛似域 a.com

hashdirpath:

maxalias: 10000

maxusers: 10000

maxquota: 524288000S

maxnetdiskquota: 524288000S

transport:

can_signup: 0

default_quota: 5242880S

default_netdiskquota:5242880S

default_expire: 1y

disablesmtpd: 0

disablesmtp: 0

disablewebmail: 0

disablenetdisk: 0

disableimap: 1

disablepop3: 0

createdate: 2013-10-18 12:19:58

expiredate: 0000-00-00

active: 1

2 rows in set(0.00 sec)

***************************3. row ***************************

domain: b.com

description: 虛似域 b.com

hashdirpath:

maxalias: 10000

maxusers: 10000

maxquota: 524288000S

maxnetdiskquota: 524288000S

transport:

can_signup: 1

default_quota: 5242880S

default_netdiskquota:5242880S

default_expire: 1y

disablesmtpd: 0

disablesmtp: 0

disablewebmail: 0

disablenetdisk: 0

disableimap: 1

disablepop3: 0

createdate: 2013-10-18 12:23:27

expiredate: 0000-00-00

active: 1

3 rows in set(0.00 sec)

125647364.png

125652932.png

125703729.png

125708618.png

mysql> select* from mailbox \G //查看mailbox表可以看到創建的郵箱賬號

***************************1. row ***************************

username: [email protected]

uid: postmaster

password: $1$phz1mRrj$3ok6BjeaoJYWDBsEPZb5C0

clearpwd:

name: PostMaster

mailhost:

maildir:extmail.org/postmaster/Maildir/

homedir: extmail.org/postmaster

quota: 104857600S

netdiskquota: 52428800S

domain: extmail.org

uidnumber: 1000

gidnumber: 1000

createdate: 2007-02-14 15:10:04

expiredate: 2010-11-08

active: 1

disablepwdchange:0

disablesmtpd: 0

disablesmtp: 0

disablewebmail: 0

disablenetdisk: 0

disableimap: 0

disablepop3: 0

question: my question

answer: my answer

***************************2. row ***************************

username: [email protected]

uid: test1

password:$1$g2lXGwvx$cC5sxCJfSke3TsQf6QjAC0

clearpwd:

name: test1

mailhost:

maildir: a.com/test1/Maildir/

homedir: a.com/test1

quota: 5242880S

netdiskquota: 5242880S

domain: a.com

uidnumber: 1000

gidnumber: 1000

createdate: 2013-10-18 14:08:08

expiredate: 0000-00-00

active: 1

disablepwdchange:0

disablesmtpd: 0

disablesmtp: 0

disablewebmail: 0

disablenetdisk: 0

disableimap: 1

disablepop3: 0

question:

answer:

***************************3. row ***************************

username: [email protected]

uid: test2

password:$1$DQmgCDJn$GvUKGigbIV5uEo6LUjC3J.

clearpwd:

name: test2

mailhost:

maildir: b.com/test2/Maildir/

homedir: b.com/test2

quota: 5242880S

netdiskquota: 5242880S

domain: b.com

uidnumber: 1000

gidnumber: 1000

createdate: 2013-10-18 14:13:52

expiredate: 0000-00-00

active: 1

disablepwdchange:0

disablesmtpd: 0

disablesmtp: 0

disablewebmail: 0

disablenetdisk: 0

disableimap: 1

disablepop3: 0

question:

answer:

3 rows in set(0.00 sec)

125835880.png

125842288.png

[root@mailextman]# tail -f /var/log/maillog //系統郵件日志中可以看到郵件發送的過程

Oct 18 14:36:13mail postfix/smtpd[7673]: warning: dict_nis_init: NIS domain name not set - NISlookups disabled

Oct 18 14:36:13mail postfix/smtpd[7673]: connect from localhost.localdomain[127.0.0.1]

Oct 18 14:36:13mail postfix/smtpd[7673]: 5470913CB0C: client=localhost.localdomain[127.0.0.1]

Oct 18 14:36:13mail postfix/cleanup[7679]: 5470913CB0C:message-id=<[email protected]>

Oct 18 14:36:13mail postfix/qmgr[6483]: 5470913CB0C: from=<[email protected]>, size=629,nrcpt=1 (queue active)

Oct 18 14:36:13mail postfix/smtpd[7673]: disconnect from localhost.localdomain[127.0.0.1]

Oct 18 14:36:13mail postfix/virtual[7681]: 5470913CB0C: to=<[email protected]>, relay=virtual,delay=0.13, delays=0.06/0/0/0.07, dsn=2.0.0, status=sent (delivered to maildir)

Oct18 14:36:13 mail postfix/qmgr[6483]: 5470913CB0C: removed

130042535.png

130045353.png

130048564.png

[root@mailextman]# tail -f /var/log/maillog

Oct 18 14:40:26mail postfix/smtpd[7703]: warning: dict_nis_init: NIS domain name not set - NISlookups disabled

Oct 18 14:40:26mail postfix/smtpd[7703]: connect from localhost.localdomain[127.0.0.1]

Oct 18 14:40:26mail postfix/smtpd[7703]: 9DE2B13CB0F: client=localhost.localdomain[127.0.0.1]

Oct 18 14:40:26mail postfix/cleanup[7709]: 9DE2B13CB0F:message-id=<[email protected]>

Oct 18 14:40:26mail postfix/qmgr[6483]: 9DE2B13CB0F: from=<[email protected]>, size=1119,nrcpt=1 (queue active)

Oct 18 14:40:26mail postfix/smtpd[7703]: disconnect from localhost.localdomain[127.0.0.1]

Oct 18 14:40:26mail postfix/virtual[7711]: 9DE2B13CB0F: to=<[email protected]>, relay=virtual,delay=0.24, delays=0.06/0.01/0/0.16, dsn=2.0.0, status=sent (delivered tomaildir)

Oct 18 14:40:26mail postfix/qmgr[6483]: 9DE2B13CB0F: removed

Oct 18 14:40:48mail extmail[7717]: user=<[email protected]>, client=192.168.3.10,module=login, status=loginok

2、配置Mailgraph_ext,使用Extman的圖形日志:(下面所需的軟件包面要自己下載)

接下來安裝圖形日志的運行所需要的軟件包Time::HiRes、File::Tail和rrdtool,其中前兩個包您可以去http://search.cpan.org搜索並下載獲得,後一個包您可以到 http://oss.oetiker.ch/rrdtool/pub/?M=D下載獲得;注意安裝順序不能改換。

 

安裝Time::HiRes

#tar zxvfTime-HiRes-1.9707.tar.gz

#cd Time-HiRes-1.9707

#perlMakefile.PL

#make

#make test

#make install

 

安裝File::Tail

#tar zxvfFile-Tail-0.99.3.tar.gz

#cdFile-Tail-0.99.3

#perlMakefile.PL

#make

#make test

#make install

 

安裝rrdtool-1.2.23

#tar zxvfrrdtool-1.2.23.tar.gz

#cdrrdtool-1.2.23

#./configure--prefix=/usr/local/rrdtool

#make

#make install

 

創建必要的符號鏈接(Extman會到這些路徑下找相關的庫文件)

#ln -sv/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/

#ln -sv/usr/local/rrdtool/lib/perl/5.8.8/RRDp.pm /usr/lib/perl5/5.8.5

#ln -sv/usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/RRDs.pm /usr/lib/perl5/5.8.8

 

復制mailgraph_ext到/usr/local,並啟動之

# cp -r/var/www/extsuite/extman/addon/mailgraph_ext /usr/local

#/usr/local/mailgraph_ext/mailgraph-init start

 

啟動cmdserver(在後台顯示系統信息)

#/var/www/extsuite/extman/daemon/cmdserver --daemon

 

添加到自動啟動隊列

# echo“/usr/local/mailgraph_ext/mailgraph-init start” >> /etc/rc.d/rc.local

# echo“/var/www/extsuite/extman/daemon/cmdserver -v -d” >> /etc/rc.d/rc.local

 

使用方法:等待大約15分鐘左右,如果郵件系統有一定的流量,即可登陸到extman裡,點“圖形日志”即可看到圖形化的日志。具體每天,周,月,年的則點擊相應的圖片進入即可。

 

本文出自 “網絡CTO” 博客,請務必保留此出處http://7392072.blog.51cto.com/7382072/1311172

Copyright © Windows教程網 All Rights Reserved