企业级邮件服务器的搭建——postfix
电子邮件:
电子邮件的收发流程:
MUA:Mail User Agent邮件用户代理
MTA:Mail Transfer Agent 邮件传输代理
MDA:Mail Delivery Agent 邮件投递代理
MRA:Mail Received Agent 邮件收取代理
使用的协议:
发: smtp :简单邮件传输协议 tcp 25 simple mail transfer protocol
收: pop3 :邮局协议第三版 tcp 110 post office protocol 3
imap :互联网消息访问协议tcp 143 internet message access protocol
常见的电子邮件的应用程序比较:
redhat 5 默认 sendmail:古老的MTA,安全和易用性不太好
redhat 6 默认 postfix :
qmail:非常安全,更新和补丁跟不上。
postfix的优势: 1、免费的 2、更快速 3、兼容性 4、更健壮 5、更灵活 6、安全性
Postfix的安装与配置步骤:
安装与配置postfix:
准备软件安装包
[root@localhost docs]# ls postfix.tar.gz postfix.tar.gz 解压压缩包
[root@localhost docs]# tar zxvf postfix.tar.gz -C / 进入解压路径
[root@localhost /]# cd /postfix/ [root@localhost postfix]# ls
配 yum:
配置yum源,dhcp获取
[root@localhost postfix]# vim /etc/yum.repos.d/ftp.repo [base]
name=base
baseurl=ftp://192.168.7.249/iso/Server enabled=1 gpgcheck=0
[postfix]
name=postfix
baseurl=file:///postfix enabled=1 gpgcheck=0
1、安装postfix:
[root@localhost postfix]# yum install -y postfix
2、处理后事: 停掉 所有占用25端口的服务。
[root@localhost postfix]# /etc/init.d/sendmail stop
[root@localhost postfix]# chkconfig sendmail off
切换 MTA:***
[root@localhost postfix]# alternatives --config mta
There are 2 programs which provide 'mta'.
Selection Command
-----------------------------------------------
*+ 1 /usr/sbin/sendmail.sendmail 2 /usr/sbin/sendmail.postfix
Enter to keep the current selection[+], or type selection number: 2
设置主机名: 临时:
[root@localhost postfix]# hostname mail.extmail.org vim /etc/sysconfig/network HOSTNAME=
配置DNS:
[root@localhost postfix]# yum install -y bind bind-chroot
[root@localhost postfix]# cd /var/named/chroot/etc/ [root@localhost etc]# ls localtime rndc.key 编辑配置文件
[root@localhost etc]# vim named.conf options {
directory \};
zone \ type master;
file \};
进入配置文件样例目录,并拷贝样例配置文件 [root@localhost etc]# cd ../var/named/
[root@localhost named]# cp /usr/share/doc/bind-9.3.6/sample/var/named/localhost.zone extmail.org.zone
编辑区域配置文件
[root@localhost named]# vim extmail.org.zone $TTL 86400
@ IN SOA ns.extmail.org. root (
42 ; serial (d. adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum
@ IN NS ns.extmail.org. ns IN A 127.0.0.1
@ IN MX 3 mail.extmail.org. mail IN A 192.168.7.249
启动dns配置
[root@localhost named]# /etc/init.d/named restart
测试:
指定dns服务器
[root@localhost named]# vim /etc/resolv.conf
[root@localhost named]# cat /etc/resolv.conf search localdomain
nameserver 192.168.7.249
测试dns服务器是否解析成功
[root@localhost named]# host -t mx extmail.org extmail.org mail is handled by 3 mail.extmail.org.
[root@localhost named]# nslookup mail.extmail.org Server: 192.168.7.249 Address: 192.168.7.249#53
Name: mail.extmail.org Address: 192.168.7.249
=========== 配置MTA: ===========
[root@mail named]# cd /etc/postfix/ [root@mail postfix]# ls 配置文件解释
[root@mail postfix]# ls readme/ #有各种配置文件参数的解释
生成新的配置文件:
[root@mail postfix]# postconf -n > main.cf 编辑配置文件
[root@mail postfix]# vim main.cf config_directory = /etc/postfix
mynetworks = 127.0.0.1 192.168.7.0/24 #定义信任的邮件转发列表 myhostname = mail.extmail.org #定义主机名,必须的 mydomain = extmail.org #定义域名 mydestination = $mynetworks $myhostname #定义哪些是本域的邮件 mail_name = My_Postfix #定义登录服务器显示的信息 smtpd_banner = $myhostname MySMTP $mail_name #定义欢迎信息 smtpd_error_sleep_time = 0s #有错误,立即响应 message_size_limit = 5120000 #限制单个邮件的大小,字节 mailbox_size_limit = 51200000 #限制邮箱的大小 show_user_unknown_table_name = no #不显示未知的邮件
相关推荐: