安装CENTOS 6.5 32位(CentOS-6.5-i386)+postfix+dovecot+openwebmail passwd验证的邮件系统。
- 安装服务器分区:/BOOT分区至少200M,swap分区物理内存的1-2倍,分配/home /var目录到另1块硬盘,分配启动硬盘剩余的容量到/分区
- 选择服务器平台的模式,在组件中分别选择好编辑环境,gnome窗口模式,samba,vsftpd
- 禁用防火墙,Selinux模式disable /etc/selinux/config SELINUX=disabled
- 设置网络 外网环境
- 安装VNC server
rpm -ivh vnc-server-4.1.2-14.el5_6.6.x86_64.rpm
yum install lib*
rpm -qa|grep vnc
tigervnc-server-1.1.0-16.el6.centos.i686
tigervnc-server-module-1.1.0-16.el6.centos.i686
tigervnc-1.1.0-16.el6.centos.i686
gtk-vnc-0.3.10-3.el6.i686
rpm -qa |grep vsftpd
vsftpd-2.2.2-11.el6_4.1.i686
rpm -qa |grep bind 域名+ SAMBA
bind-utils-9.8.2-0.17.rc1.el6_4.6.i686
bind-dyndb-ldap-2.3-5.el6.i686
samba-winbind-clients-3.6.9-164.el6.i686
bind-9.8.2-0.17.rc1.el6_4.6.i686
ypbind-1.20.4-30.el6.i686
bind-chroot-9.8.2-0.17.rc1.el6_4.6.i686
rpcbind-0.2.0-11.el6.i686
samba-winbind-3.6.9-164.el6.i686
bind-libs-9.8.2-0.17.rc1.el6_4.6.i686
PackageKit-device-rebind-0.5.8-21.el6.i686
6. 安装dovecot
yum install libmysqlclient*
yum install libmysql*
yum install perl*
yum install dovecot
查询软件安装情况
rpm -qa|grep postfix
postfix-2.6.6-2.2.el6_1.i686
rpm -qa|grep dovecot
dovecot-2.0.9-19.el6_7.2.i686
7. 切换MTA
alternatives --config mta
rpm -e sendmail
cd /usr/sbin/
ls
mv sendmail sendmail.bak
newaliases
ln -s sendmail.postfix sendmail
cd /etc/postfix/
mv main.cf main.cf.bak
{
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,factory.tgtex.com,office.tgtex.com
unknown_local_recipient_reject_code = 550
mynetworks = 127.0.0.0/8,192.168.0.0/22
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
header_checks = regexp:/etc/postfix/header_checks
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
xxgdb $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.1.5/samples
readme_directory = /usr/share/doc/postfix-2.1.5/README_FILES
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_restriction_classes = local_only
local_only = check_recipient_access hash:/etc/postfix/local_domains,reject
smtpd_sender_restrictions = permit_mynetworks,reject_sender_login_mismatch,reject_non_fqdn_sender,reject_unknown_sender_domain
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_invalid_hostname,reject_unknown_sender_domain,reject_non_fqdn_sender,reject_non_fqdn_recipient,reject_unknown_recipient_domain,reject_unauth_pipelining,reject_unauth_destination,permit
mailbox_size_limit = 1024000000
message_size_limit = 10240000
bounce_queue_lifetime = 1800s
maximal_queue_lifetime = 1d
myhostname = mail.factory.tgtex.com
mydomain = factory.tgtex.com
}
安装 openwebmail
yum install openwebmail
cd /etc/yum.repos.d
ls
wget -q http://openwebmail.org/openwebmail/download/redhat/rpm/release/openwebmail.repo
yum install openwebmail
ls
yum install openwebmail.repo
yum install openwebmail
rpm -qa |grep openwebmail
openwebmail-2.53-6.el6.noarch
openwebmail-data-2.53-6.el6.noarch
8. 安装webmin (必须先安装好samba,dovecot,postfix,openwebmail 再安装webmin,否则网页管理不了这些软件的功能)
rpm -ivh webmin-1.791-1.noarch.rpm
less /etc/webmin/miniserv.conf 禁用SSL ssl=0
9.初始化OPENWEBMAIL
/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init
netstat -lnt
less /var/log/maillog
service postfix restart
less /var/log/maillog
10. postfix postmap 创建域名文件
less /etc/postfix/local_domains{
factory.tgtex.com ok
mail.factory.tgtex.com ok
}
postmap hash:/etc/postfix/local_domains
修改:postfix配置-一般选项:
接受邮件的域:$myhostname, localhost.$mydomain, localhost, $mydomain,factory.tgtex.com,office.tgtex.com
此邮件系统的因特网主机名:mail.factory.tgtex.com
本地因特网域名:factory.tgtex.com
本地网络:127.0.0.0/8,192.168.0.0/22
11. 修改less /etc/dovecot/conf.d/10-mail.conf 邮箱目录参数
mail_location = mbox:~/mail:INBOX=/var/spool/mail/%u
在网页中修改:dovecot的协议支持选项imap,pop3,lmtp,
用户验证方式:
Password authentication source:Unix passwd file
Authentication methods:Plain-text
12. apache服务器的 默认服务器 的 目录索引
目录索引文件:/cgi-bin/openwebmail/openwebmail.pl
13.
groupadd dovenull
useradd -M dovenull -s /sbin/nologin -g dovenull
groupadd dovecot
useradd -M dovecot -s /sbin/nologin -g dovecot
14. 修改OPENWEBMAIL首页下面的文字模板
less /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
<page_footer>
Tianjin Tiange Mail System
</page_footer>
网页写信的默认语言
# Display Preference
default_style Default
default_iconset Cool3D.Chinese.Simplified
15.WEBMIN 网络--网络配置--DNS客户--解析顺序hosts file,DNS
这个选项只要本机的hostname正常,就能收发邮件。
设置CENTOS的网关后,必须能访问外网,否则:邮件客户端发送邮件等待15秒左右,VSFTPD的FTP登陆也受影响。或者不设置网关,就不存在这个问题了