导读 postfix是一个流行的smtp服务器。smtp服务器默认端口是25(不采用ssl/tls加密的情况)。下面介绍如何在CentOS6上安装postfix。
1 . CentOS6默认安装了postfix.如果系统没有postfix,可以用以下命令安装。
[root@mail ~]# yum -y install postfix
2 . 配置postfix的main.cf,配置smtp-auth采用dovecot的sasl功能。
[root@mail ~]# vi /etc/postfix/main.cf
# 第75行: 去掉注释,并设置主机名。
myhostname = mail.opsky.top
# 第83行: 去掉注释,并设置域名。
mydomain = opsky.top
# 第99行: 去掉注释。
myorigin = $mydomain
# 第116行: 
inet_interfaces = all
# 第119行: 如果只使用ipv4,那么设置如下。
inet_protocols = ipv4
# 第164行: 配置可接收邮件的域名。
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
# 第264行: 去掉注释,并设置本地网络号段.
mynetworks = 127.0.0.0/8, 10.0.0.0/24
# 第419行: 去掉注释,采用Maildir格式。
home_mailbox = Maildir/
# 第571行: 
smtpd_banner = $myhostname ESMTP
# 添加如下配置到文件末尾
# 一封邮件大小限制为10M
message_size_limit = 10485760
# 一个邮箱大小限制为1G
mailbox_size_limit = 1073741824
# 配置SMTP-Auth采用dovecot的sasl功能
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject
main.cf配置完毕后,启动postfix,并设置自动启动。

[root@mail ~]# /etc/rc.d/init.d/postfix start 
Starting postfix: [  OK  ]
[root@mail ~]# chkconfig postfix on
3 . 如果iptables在开启状态,那么设置iptables开放smtp的25端口。
[root@dlp ~]# iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 25 -j ACCEPT

原文来自:http://www.centoscn.com/CentosServer/lighttpd/2017/1103/9118.html

本文地址:https://www.linuxprobe.com/centos6-postfix.html编辑:任维国,审核员:逄增宝

本文原创地址:https://www.linuxprobe.com/centos6-postfix.html编辑:public,审核员:暂无