1.关闭Sendmail服务:

查看Sendmai服务在监听TCP25端口
netstat -nutlp | grep :25

关闭Sendmail
/etc/rc.d/init.d/sendmail stop
chkconfig sendmail off
chkconfig sendmail –list

2.安装Postfix,在DISK4上
用rpm -ivh 安装

确认命令:
rpm -q postfix

3.配置/etc/postfix/main.cf,用域名例:syw.sh.cn

以下是需要修改的地方
myhostname = song.syw.sh.cn
mydomain = syw.sh.cn
myorigin = $mydomain
inet_interface = all
#inet_interfaces = local
mydestination = $mydomain, $myhostname, localhosst, localhost.$mydomain
#mynetworks = 192.168.16.0/28, 127.0.0.0/8
mynetworks_style = subnet
relay_domains = $mydestination

3。安装Cyrus-SASL , 在DISK2、3上
确认命令:
rpm -qa | grep sasl

cyrus-sasl-sql
cyrus-sasl-md5
cyrus-sasl-plain
cyrus-sasl-devel
cyrus-sasl-ntlm
cyrus-sasl
cyrus-sasl-gssapi
共以上7个文件

验证机制选择:
saslauthd -v
MACH=shadow

启动及测试:
ps aux | grep saslauthd
/etc/init.d/saslauthd start
chkconfig saslauthd on
/usr/sbin/testsaslauthd -u song -p ‘xxxxxx’
(其中song是LINUX用户名,xxxxxx是密码)

4。设置/etc/postfix/main.cf启用SMTP
在最后加上:
#Cyrus-SASL
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
#
#Cyrus-imapd
mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp

5.启动postfix
/etc/init.d/postfix start

测试:
telnet song.syw.sh.cn 25
EHLO 163.com
EHLO sh163.net
quit

chkconfig postfix on
chkconfig postfix –list

开放25端口
iptables -I INPUT -p tcp –dport 25 -j ACCEPT

6。安装Cyrus-imapd服务,在DISK4上,使用rpm -ivh命令
例:
rpm -ivh /media/cdrom/RedHat/RPMS/cyrus-imapd-devel-2.2.12-3.RHEL4.1.i386.rpm

确认命令:
rpm -qa | grep cyrus-imapd
rpm -qa | grep perl-Cyrus

cyrus-imapd-nntp
cyrus-imapd-
cyrus-imapd-devel
cyrus-imapd-murder
perl-Cyrus
cyrus-imapd-utils
共6个文件,utils一定要在perl后安装

启动cyrus-imapd:
service cyrus-imapd start
chkconfig cyrus-imapd on
chkconfig cyrus-imapd –list

7.用户邮箱管理

设定管理员密码:
passwd cyrus

为用户创建邮箱:
/usr/lib64/cyrus-imapd/cyradm -u cyrus localhost
输入管理员密码后进入管理命令状态

>cm user.song
>cm user.song.Send
>cm user.song.Trash
>cm user.song.Drafts

设置配额:(例:5M)
>sq user.song 5210
>listquota user.song

退出:
>quit

8。查看运行LOG
tail -f /var/log/maillog

参考:http://wistariax.spaces.live.com/blog/cns!11D78325927309D0!266.entry

发表评论