Install postfix on CentOS6 and set sasl
Postfix is a popular smtp server. The default port of the smtp server is 25 (ssl/tls encryption is not used ).
The following describes how to install postfix on CentOS6.
1. postfix is installed in CentOS6 by default. if the system does not have a postfix, run the following command to install it.
[root@mail ~]# yum -y install postfix
2. Configure main. cf of postfix and use sasl of dovecot for smtp-auth.
[Root @ mail ~] # Vi/etc/postfix/main. cf # Row 75th: remove the comment and set the host name. Myhostname = mail. opsky. top # Row 83rd: remove the comment and set the domain name. Mydomain = opsky. top # 99th rows: Remove comments. Myorigin = $ mydomain # Row 116th: inet_interfaces = all # Row 119th: If only ipv4 is used, set as follows. Inet_protocols = ipv4 # Row 164th: configure the domain name for receiving emails. Mydestination = $ myhostname, localhost. $ mydomain, localhost, $ mydomain # Line 264th: remove the comment and set the local network number segment. mynetworks = 127.0.0.0/8, 10.0.0.0/24 # Row 419th: remove the comment and use Maildir format. Home_mailbox = Maildir/# 571st rows: smtpd_banner = $ myhostname ESMTP # Add the following configuration to the end of the file # the size of an email is limited to 10Mmessage_size_limit = 10485760 # the size of one email is limited to 1Gmailbox_size_limit = 1073741824 # configure SMTP smtpd_sasl_type = dovecotsmtpd_sasl_path = private/authsmtpd_sasl_auth_enable = yessmtpd_sasl_security_options = Authorization = $ authorization = permit_mynetworks, permit_auth_destination, permit_sasl_authenticated, reject
After main. cf is configured, start postfix and set automatic start.
[root@mail ~]# /etc/rc.d/init.d/postfix start Starting postfix: [ OK ][root@mail ~]# chkconfig postfix on
3. If iptables is enabled, set iptables to open port 25 of smtp.
[root@dlp ~]# iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 25 -j ACCEPT