#搭建WebMail郵件伺服器#1.關閉系統預設安裝的 sendmail:[root@red4 ~]# service sendmail stop關閉 sendmail: [失敗][root@red4 ~]#[root@red4 ~]# chkconfig --level 35 sendmail off[root@red4 ~]#[root@red4 ~]# chkconfig --list sendmailsendmail 0:關閉 1:關閉 2:關閉 3:關閉 4:關閉 5:關閉 6:關閉[root@red4 ~]##2.安裝提供郵件服務的軟體包[root@red4 ~]# yum list | grep postfixThis system is not registered with RHN.RHN support will be disabled.postfix.i386 2:2.3.3-2.1.el5_2 rhel5 postfix-pflogsumm.i386 2:2.3.3-2.1.el5_2 rhel5 [root@red4 ~]# yum install -y postfix#3.修改設定檔[root@red4 ~]# cd /etc/postfix/[root@red4 postfix]# lsaccess generic main.cf master.cf post-install transportbounce.cf.default header_checks main.cf.default postfix-files relocated virtualcanonical LICENSE makedefs.out postfix-script TLS_LICENSE[root@red4 ~]# vim main.cf 1 myhostname = mail.163.com 2 mydomain = 163.com 3 myorigin = $mydomain 4 inet_interfaces = 192.168.101.104,127.0.0.1 5 mydestination = $myhostname,$mydomain 6 home_mailbox = Maildir/#4.啟動服務[root@red4 postfix]# service postfix start啟動 postfix: [確定][root@red4 postfix]##5.查看服務的進程名和監聽的連接埠#注意:這裡尋找的是<master>[root@red4 postfix]# netstat -utnap | grep mastertcp 0 0 192.168.101.104:25 0.0.0.0:* LISTEN 13370/master tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 13370/master [root@red4 postfix]##6.Postfix 使用本地系統帳號作為郵件帳號<passwd=111>[root@red4 postfix]# useradd userone[root@red4 postfix]# passwd useroneChanging password for user userone.New UNIX password: BAD PASSWORD: it is WAY too shortRetype new UNIX password: passwd: all authentication tokens updated successfully.[root@red4 postfix]# useradd usertwo[root@red4 postfix]# passwd usertwoChanging password for user usertwo.New UNIX password: BAD PASSWORD: it is WAY too shortRetype new UNIX password: passwd: all authentication tokens updated successfully.[root@red4 postfix]##7.安裝提供收郵件服務的軟體包#注意:如果提示依賴錯誤,需要安裝<mysql>和<perl>[root@red4 postfix]# yum list | grep dovecotThis system is not registered with RHN.RHN support will be disabled.dovecot.i386 1.0.7-7.el5 rhel5 [root@red4 postfix]# yum install -y dovecot#8.修改dovecot的設定檔[root@red4 postfix]# cat /etc/dovecot.conf | grep "mail_location = maildir:~/Maildir"# mail_location = maildir:~/Maildir[root@red4 postfix]# cat /etc/dovecot.conf | grep protocols#protocols = imap imaps pop3 pop3s[root@red4 postfix]##9.啟動服務\查看連接埠[root@red4 postfix]# service dovecot start啟動 Dovecot Imap: [確定][root@red4 postfix]# netstat -utnap | grep dovecottcp 0 0 :::993 :::* LISTEN 13537/dovecot tcp 0 0 :::995 :::* LISTEN 13537/dovecot tcp 0 0 :::110 :::* LISTEN 13537/dovecot tcp 0 0 :::143 :::* LISTEN 13537/dovecot [root@red4 postfix]# #10.安裝WEB用戶端程式#注意:可能會提示PHP依賴,需要安裝<php-mbstring>[root@red4 postfix]# yum list | grep squirrelmailThis system is not registered with RHN.RHN support will be disabled.squirrelmail.noarch 1.4.8-5.el5_4.10 rhel5 [root@red4 postfix]# yum install -y squirrelmail#11.開啟HTTPD服務[root@red4 postfix]# service httpd restart停止 httpd: [確定]啟動 httpd: [確定][root@red4 postfix]# #修改squirrelmail支援語言[root@red4 postfix]# vim /etc/squirrelmail/config.php#26 $squirrelmail_default_language = 'zh_CN';#59 $default_charset = 'UTF-8';#12.開啟瀏覽器測試#注意:開啟失敗後,檢查您的DNS配置,看看是否正確.#使用剛才建立的<userone><usertwo>使用者登入.http://www.wing.com/webmail/src/login.php###############################################問題###############################################Q1.不能使用<root>使用者登入不知道為什麼?#Q2.可以登入,使用<userone>登入後,給<usertwo@mail.wing.com>發郵件#<usertwo>接收不到,為什麼?###############################################郵件系統DNS配置###############################################1修改named.conf[root@red4 etc]# pwd/var/named/chroot/etc[root@red4 etc]# cat named.conf options{ directory "/var/named";}; zone "wing.com" IN { type master; file "wing.com.zone"; }; zone "101.168.192.in-addr.arpa." IN { type master; file "mail.com.arpa"; }; #2.建立wing.com.zone[root@red4 named]# pwd/var/named/chroot/var/named[root@red4 named]# cat wing.com.zone $TTL 7200wing.com. IN SOA dns.wing.com. root.wing.com. ( 20130606 1H 15M 1W 1D ) IN NS dns.wing.com.dns.wing.com. IN A 192.168.101.104mail.wing.com. IN A 192.168.101.104wing.com. IN MX 10 mail.wing.com.#3.測試[root@red4 named]# host mail.wing.commail.wing.com has address 192.168.101.104[root@red4 named]# host dns.wing.comdns.wing.com has address 192.168.101.104[root@red4 named]# [root@red4 named]# host -t PTR 192.168.101.104104.101.168.192.in-addr.arpa domain name pointer dns.wing.com.104.101.168.192.in-addr.arpa domain name pointer mail.wing.com.[root@red4 named]# [root@red4 named]# nslookup > set type=mx> wing.comServer: 127.0.0.1Address: 127.0.0.1#53 wing.com mail exchanger = 10 mail.wing.com.> > set type=ptr> 192.168.101.104Server: 127.0.0.1Address: 127.0.0.1#53 104.101.168.192.in-addr.arpa name = mail.wing.com.104.101.168.192.in-addr.arpa name = dns.wing.com.> > set type=a> mail.wing.comServer: 127.0.0.1Address: 127.0.0.1#53 Name: mail.wing.comAddress: 192.168.101.104>