搭建postfix邮件服务器(rpm包)
|
mail IN A 172.16.100.147
lwb.com. IN MX 10 mail
|
|
147 IN PTR lwb.com.
|
|
[root@mail ~]# bind-chroot-admin –s
|
|
[root@mail ~]# service named restart
[root@mail ~]# chkconfig named on
|
|
[root@mail ~]# mkdir /media/rhel5
[root@mail ~]# mount /dev/cdrom /media/rhel5
[root@mail ~]# cd /media/rhel5/Server
[root@mail Server]# rpm -ivh createrepo-0.4.4-2.fc6.noarch.rpm
[root@mail Server]# cd /media/
[root@mail media]# createrepo .
[root@mail ~]# vi /etc/yum.repos.d/rhel-debuginfo.repo
修改为以下内容
[rhel5]
baseurl=file:///media
enabled=1
gpgcheck=0
|
|
[root@mail ~]# rpm -ivh postfix-2.3.3-2.i386.rpm
|
|
[root@mail ~]# vi /etc/postfix/main.cf
inet_interfaces = all //设置监听25端口在哪些IP地址可以使用
myhostname = mail.lwb.com //设置Postfix服务器使用的主机名
mydomain = lwb.com //设置Postfix服务器使用的邮件域
myorigin = $mydomain //设置发件人邮件地址中的邮件域名
mydestination = $mydomain,$myhostname //设置可接收的邮件地址中的域名
home_mailbox = Maildir/ //设置邮件存储位置和格式
|
|
[root@mail ~]# service postfix restart
[root@mail ~]# chkconfig postfix on
[root@mail ~]# netstat -antp |grep :25
查看其25端口是否是如下信息(看是否有4个0)
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 4626/master
|
|
[root@mail ~]# yum install dovecot* -y
|
|
[root@mail ~]# vi /etc/dovecot.conf
ssl_disable = yes //禁用SSL机制
protocols = pop3 imap //指定支持的邮局协议
disable_plaintext_auth = no //允许明文密码认证
mail_location = maildir:~/Maildir //设置邮件存储格式及位置
|
|
[root@mail ~]# vi /etc/pam.d/dovecot
#%PAM-1.0
auth required pam_nologin.so
auth include system-auth
account include system-auth
session include system-auth
|
|
[root@mail ~]# service dovecot restart
[root@mail ~]# chkconfig dovecot on
查看其端口信息
[root@mail ~]# netstat -anpt |grep dovecot
tcp 0 0 :::110 :::* LISTEN 4687/dovecot
tcp 0 0 :::143 :::* LISTEN 4687/dovecot
|
|
[root@mail ~]# yum install squirrelmail* -y
|
|
[root@mail ~]# cd /var/www/html/mail/
[root@mail mail]#mkdir attach data
[root@mail mail]#chown –R daemon.daemon attach data
[root@mail mail]#chmod 730 attach
|
|
[root@mail ~]# ln -s /usr/share/squirrelmail/ /var/www/html/mail
[root@mail ~]# cd /var/www/html/mail/config
[root@mail config]# vi config.php
$squirrelmail_default_language = 'zh_CN';
$default_charset = 'zh_CN.UTF-8';
$domain = 'lwb.com';
$smtpServerAddress = 'localhost';
$smtpPort = 25;
$imap_server_type = 'dovecot';
$imapPort = 143;
$data_dir = '/var/www/html/mail/data/';
$attachment_dir = '/var/www/html/mail/attach/';
|
|
[root@mail ~]# service httpd restart
[root@mail ~]# chkconfig httpd on
|
|
[root@mail ~]#vi /etc/postfix/main.cf //添加下面内容
smtpd_sas1_auth_enable = yes
smtpd_sas1_security_options = noannonymous
mynetworks = 127.0.0.1
smtpd_recipient_restrictions=permit_mynetworks,permit_sas1_authenticated,reject_unauth_destination
|
|
[root@mail ~]# service saslauthd restart
[root@mail ~]# chkconfig saslauthd on
|
|
[root@mail ~]# service postfix restart
|
|
[root@mail ~]#vi /etc/aliases
zu:user1,user2,user3,user4
[root@mail ~]#newaliases
|
|
[root@mail ~]# vi /etc/postfix/main.cf
message_size_limit = 20971520
|
|
[root@mail ~]#chkconfig –level 35 iptables off
[root@mail ~]#vi /etc/selinux/config
SELINUX=disabled
[root@mail ~]#reboot
|
本文出自 “刘文斌” 博客,谢绝转载!