先关闭sendmail

service sendmail stop

chkconfig sendmail off

安装DNS

mount /dev/cdrom /mnt

yum install bind-*

配置主DNS服务器

vim /var/named/chroot/etc/named.conf

options {

       directory "/var/named";

};

zone    "daijingjie.com" {

        type  master;

        file  "daijingjie.com.zone";

};

:wq!

cp /usr/share/doc/bind-9.3.6/sample/var/named/localhost.zone /var/named/chroot/var/named/daijingjie.com.zone

vim /var/named/chroot/var/named/daijingjie.com.zone

$TTL    86400

@               IN SOA  @       root (

                                       42              ; serial (d. adams)

                                       3H              ; refresh

                                       15M             ; retry

                                       1W              ; expiry

                                       1D )            ; minimum

daijingjie.com.           IN NS          mail.daijingjie.com.

mail.daijingjie.com.   IN A            192.168.18.35

daijingjie.com.           IN MX 10    mail.daijingjie.com.

:wq!

重启named

service named restart

echo "" > /etc/resolv.conf

host mail.daijingjie.com

显示:mail.daijingjie.com has address 192.168.18.35  //表示成功

安装postfix

yum install postfix -y

vim /etc/postfix/main.cf

69 myhostname = mail.daijingjie.com

77 mydomain = daijingjie.com

92 myorigin = $mydomain

107 inet_interfaces = all

110 #inet_interfaces = localhost

155 mydestination = $myhostname,$mydomain

255 mynetworks = 192.168.18.0/24, 127.0.0.0/8

287 relay_domains = daijingjie.com

:wq!

查看是否安装cyrus-sasl

rpm -qa | grep cyrus-sasl

显示:cyrus-sasl-lib-2.1.22-5.el5_4.3

       cyrus-sasl-2.1.22-5.el5_4.3

       cyrus-sasl-plain-2.1.22-5.el5_4.3    //已经安装

vim /etc/sysconfig/saslauthd

修改  MECH=shadow

创建一个用户

useradd daijingjie

passwd daijingjie

重启saslauthd

/etc/init.d/saslauthd restart


chkconfig saslauthd on

测试用户

testsaslauthd -u daijingjie -p'123456.'

显示: 0: OK "Success."  //成功

修改postfix配置文件

vim /etc/postfix/main.cf

在最后加上:

smtpd_sasl_auth_enable = yes

smtpd_sasl_local_domain = ''

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

broken_sasl_auth_clients = yes

smtpd_client_restrictions = permit_sasl_authenticated

smtpd_sasl_security_options = noanonymous

:wq!

重启postfix

service postfix restart

安装dovecot

yum install dovecot -y

修改dovecot配置文件

vim /etc/dovecot.conf

20 protocols = pop3 pop3s

35 protocol pop3 {

36      listen = *:10100

37 #     ..

38 }

:wq!

/etc/init.d/dovecot restart

chkconfig dovecot on

安装imap

yum install cyrus-imapd cyrus-imapd-devel -y

vim /etc/postfix/main.cf

456 mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp

:wq!

passwd cyrus

/etc/init.d/cyrus-imapd restart

chkconfig cyrus-imapd on

测试:

cyradm -u cyrus localhost

IMAP Password:

             localhost.localdomain> cm user.daijingjie

localhost.localdomain> quit

安装squirrelmail

yum install squirrelmail -y

/usr/share/squirrelmail/config/conf.pl

Command >>d -- cyrus -- 2 -- 1-- daijingjie.com -- 3 -- 2 -- r -- 4 -- 5 -- y -- r -- 10 -- 1 -- zh_CN -- 2 -- gb2312 -- r -- s -- q

重启postfix

service postfix restart