查看DNSAPACH服务是否安装:

Rpm qa | grep bind

Rpm qa | grep httpd

停用sendmail服务,并关闭开机启动

Service sendmail stop

Chkconfig sendmail off

配置DNS主配置文件:

Vim /var/named/chroot/etc/named.conf

       Options{

              Directory /var/named

       };

       Zone   zouying.com{

               Type  master;

               File   zouying.com.zone;

};

拷贝区域文件模板文件:

Cp/usr/share/doc/bind-9.3.6/sample/var/named/localdomain.zone /var/named/chroot/var/named/zouying.com.zone

配置DNS区域文件:

Vim /var/named/chroot/var/named/zouying.com.zone

             @                 IN SOA localhost root(

                                                  42

                                                  3H

                                                  15M

                                                  1W

                                                   1D)

              Zouying.com.         IN NS     mail.zouying.com.

              Mail.zouying.com      IN A      192.168.18.73

              Zouying.com.         IN MX 10   mail.zouying.com.

      

启动DNS服务并设置开机启动:

Service named start 

Chkconfig named on

测试域名解析是否正常:

Echo  “” > /etc/resolv.conf

Host mail.zouying.com

安装postfix服务:

Yum install postfix

配置postfix主配置文件:vim /etc/postfix/main.cf

     更改字段:myhostname = mail.zouying.com    定义主机名与DNS中一致

               Mydomain = zouying.com          定义域名

               Myorigin = $mydomain

               Inet_interfaces = all 

               #inet_interfaces = localhost

               Mydestination = $myhostname,$mydomain

               Mynetworks = 192.168.18.0/24, 127.0.0.0/8

               Relay_domains = zouying.com

启动认证服务:/etc/init.d/saslauthd start

修改SMTP认证的配置文件:vim /etc/sysconfig/saslauthd 

                        MECH = shadow

重启认证服务: /etc/init.d/saslauthd restart

建立用户:useradd aaa 

          Passwd aaa

测试认证:testsaslauthd u aaa aaa

          显示OK Success  认证服务成功!

将认证加到启动项中: chkconfig saslauthd on

修改邮件服务器配置文件,关联SMTPPostfixvim /etc/postfix/main.fix

Readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES

Smtpd_sasl_auth_enable = yes

Smtpd_sasl_local_domain = ‘’

Smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject_unaut  h_destination

Broken_sasl_auth_clients = yes

Smtpd_client_restrictions = permit_sasl_wuthenticated

Smtpd_sasl_security_options = noanongmous

重启邮件服务:service postfix restart

重新设置开机启动:chkconfig postfix on

更改用户名(密码)格式:

Perl MMIME::Base64 print encode_base64(aaa);

记下显示出的字段:YWFh

实现POP&IMAP

安装dovecot :yum install dovecot

修改dovecot配置文件:vim /etc/dovecot.conf

             Protocols = POP3  POP3S

             Protocol pops{

                        Listen = *;10100

                        }

启动dovecot服务并加到启动项:service dovecot start

                              Chkconfig dovecot on

安装cyrusyum install cyrus*

修改postfix配置文件:vim /etc/postfix/main.cf

                    第456行去掉注释

启动imap服务: sercice cyrus-imapd start

加到启动项: chkconfig cyrus-imapd on 

cyrus用户设置密码为cyrus

重启邮件服务:service postfix restart

连后台,建立邮箱:cyradm u cyrus localhost

                   Cm user.aaa

                   Cm user.aaa.Send

                   Cm user.aaa.Trash

                   Cm user.aaa.Drafts

实现webmail

安装squirrelmailyum install squirrelmail

修改配置文件:vim /etc/squirrelmail/config/php &&  

Usr/share/squirrelmail/config/conf.pl

              D  cyrus

              2  

                  1 zouying.com

                  3 2

              4   5 t

启动httpd服务:service httpd start

  

所有配置完成,打开浏览器进行测试:

                http://mail.zouying.com/webmail