安装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
yum install tigervnc*
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
ftp用户通过chroot_list这个列表的真实用户,登录ftp,并记录上传下载日志到
/var/log/vsftpd.log
grep -Pv "(^$|^#)" /etc/vsftpd/vsftpd.conf
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
ftpd_banner=Welcome to tiange FTP service.
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
pam_service_name=vsftpd
userlist_enable=YES
userlist_deny=no
tcp_wrappers=YES
listen=yes
/etc/vsftpd/user_list
caduser
caddy
cadcel
cademf
zhuyw
rpm -qa |grep bind 域名+ SAMBA
yum install bind*
或者:yum install -y bind bind-chroot bind-utis
yum remove 包名 可以卸载,更新新的版本
bind-9.8.2 //bind的主文件
bind-libs-9.8.2 // bind 需要的类库
bind-chroot-9.8.2 //bind的安全模块
bind-utils-9.8.2 //bind的命令包
安装好后,通过WEBMIN,进入BIND DNS服务器--Edit Config File 把
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory "/var/named"; #服务器工作目录,配置文件相对路径
dump-file "/var/named/data/cache_dump.db"; #默认服务器存放数据库文件
statistics-file "/var/named/data/named_stats.txt"; #默认统计信息路径
memstatistics-file "/var/named/data/named_mem_stats.txt"; #默认内存使用统计文件
allow-query { any; }; #可查询主机
allow-query-cache { any; }; #缓存
这3个参数更改为any
新建主区域,主机记录,MX记录
重启named 服务
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 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
修改: /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
domainnames factory.tgtex.com
(默认是auto:会调用主机名为邮件的域名:用户名@mail.factory.tgtex.com)
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 邮箱目录参数
或者在网页中修改:dovecot的参数 mailfiles页面下的
Other Dovecot location :
mail_location = mbox:~/mail:INBOX=/var/spool/mail/%u
设置日志保存路径 /etc/dovecot/conf.d/10-logging.conf
log_path = /var/log/dovecot.log
在网页中修改:服务器---Dovecot IMAP/POP3 Server以下参数
Dovecot networking and mail protocol options:
dovecot的协议支持选项
Serve mail protocols:imap,pop3,lmtp,
Accept SSL connections:否
SSL Configuration
Disallow plaintext authentication in non-SSL mode? :否
用户验证方式:User and Login Options
Password authentication source:Unix shadow 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
/var/www/cgi-bin/openwebmail/etc/defaults/openwebmail.conf
webdisk_uploadlimit 50000 控制网络磁盘上传附件的大小
15.WEBMIN 网络--网络配置--DNS客户--解析顺序hosts file,DNS
这个选项只要本机的hostname正常,就能收发邮件。
设置CENTOS的网关后,必须能访问外网,否则:邮件客户端发送邮件等待15秒左右,VSFTPD的FTP登陆也受影响。或者不设置网关,就不存在这个问题了
16. 邮件服务器切换的时候
更改服务器的IP,更改/etc/hosts 主机名,重启网络即可
控制接收域的邮件是在/etc/postfix/main.cf 中
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,factory.tgtex.com,office.tgtex.com
邮件服务器的DNS记录 增加MX
17. system-config-services 0.99.45 centos系统--管理--服务 模块 用于服务的启停