postfix和dovecot纯文本搭建
(一)postfix的安装1.停用sendmail服务,并设置默认启动状态为关闭# service sendmail stop
2.编译安装 源码编译及安装postfix
a. 创建postfix程序用户及程序组
# groupadd -g 1200 postdrop
# groupadd -g 1000 postfix
# useradd -M -g postfix -G postdrop -s /sbin/nologin postfix
b.解包、预配置、编译、安装
# make makefiles 'CCARGS=-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl' 'AUXLIBS=-L/usr/libsasl2 -lsasl2' ;make ; make install
c.Postfix服务控制
# postfix start
postfix/postfix-script: starting the Postfix mail system
d.简化postfix邮件服务器主配置文件main.cf
# cd /etc/postfix/
# ls
access bounce.cf.defaultgeneric LICENSEmain.cf.defaultmaster.cfTLS_LICENSEvirtual
aliasescanonical header_checksmain.cfmakedefs.out relocatedtransport
# postconf -n > tem.file
# mv main.cf main.cf.bak
# mv tem.file main.cf
5.编辑主配置文件,添加以下几行
inet_interfaces = 169.254.87.2, 127.0.0.1
myhostname = mail.benet.com
mydomain = benet.com
myorigin = $mydomain
mydestination = $mydomain, $myhostname
home_mailbox = Maildir/
6.添加邮箱账号并测试
# groupadd mailusers
# useradd -g mailusers -s /sbin/nologin xinlei
# useradd -g mailusers -s /sbin/nologin zhigang
# passwd xinlei / zhigang 密码都是123
# telnet mail.benet.com 25
helo mail.benet.com
mail from:xinlei@benet.com
rcpt to:zhigang@benet.com
data
subject:A test mail
aa
gg
h
.
quit (编译安装Dovecot 邮件接收服务器)
a.创建程序用户
# useradd -M -s /sbin/nologin dovecot
# useradd -M -s /sbin/nologin dovenull
b.编译安装
# cd /soft/LNS/chapter10
# tar zxf dovecot-2.0.12.tar.gz -C /usr/src/
# cd /usr/src/dovecot-2.0.12/
# ./configure --sysconfdir=/etc ; make ; make install
c.添加系统服务dovecot
# cp doc/dovecot-initd.sh /etc/init.d/dovecot
# chmod +x /etc/init.d/dovecot
# chkconfig --add dovecot
d.建立配置文件,并启动服务
a. 建立配置文档
# cp -r /usr/local/share/doc/dovecot/example-config/* /etc/dovecot/
auth required pam_nologin.so
auth include system-auth
account include system-auth
session include system-auth
b. 调整主配置文件
83 !include conf.d/10-auth.conf
84 ssl = no
85 disable_plaintext_auth = no
86 mail_location = maildir:~/Maildir
e. 启动dovecot
# /etc/init.d/dovecot start
Starting Dovecot.
# netstat -antpl | grep dovecot
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 16028/dovecot
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 16028/dovecot
tcp 0 0 :::110 :::* LISTEN 16028/dovecot
tcp 0 0 :::143 :::* LISTEN 16028/dovecot
f. POP3接收邮件测试
# telnet mail.benet.com 110
user zhigang
pass 123
list
retr 1
quit
商女不知亡国恨、妓女不懂婚外情。 帮你顶下哈!! 一时的冲动,子孙的危机! 勃起不是万能的,但不能勃起却是万万都不能的! 有道理。。。 禽兽尚且有半点怜悯之心,而我一点也没有,所以我不是禽兽。
页:
[1]