1.安装sendmail和sendmail-cf dovecot
yum install sendmail-cf sendmail dovecot-y
2.配置sendmail
[root@mail ~]# cd /etc/mail
[root@mail mail]# vim sendmail.mc
修改Addr=127.0.0.0 改为如下的0.0.0.0
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA‘)
修改LOCAL_DOMAIN(`localhost.domain‘)改为如下的域名
LOCAL_DOMAIN(`maxmell.com.cn‘)
修改完成sendmail.mc 执行如下命令
m4 sendmail.mc >sendmail.cf
3.修改local-host-names ,添加域名maxmell.com.cn
[root@mail mail]# cat local-host-names
# local-host-names - include all aliases for your machine here.
maxmell.com.cn
4.配置访问列表
[root@mail mail]# cat access
# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost...
Connect:localhost.localdomain RELAY
Connect:localhost RELAY
Connect:127.0.0.1 RELAY
Connect:tairjiuh.com.tw RELAY
Connect:dim.tairjiuh.com.tw RELAY
Connect:maxmell.com.cn RELAY
Connect:21cn.com RELAY
Connect:192.168.0.204 RELAY
Connect:192.168.0.102 RELAY
Connect:maxmell.cn RELAY
Connect:192.168.3.106 RELAY
Connect:163.com DISCARD
Connect:sina.com DISCARD
Connect:hkdc.net DISCARD
Connect:sohu.com DISCARD
Connect:china.com DISCARD
Connect:yahoo.com DISCARD
Connect:hotmail.com DISCARD
Connect:joyo.com DISCARD
Connect:netease.com DENY
Connect:126.com DISCARD
Connect:qq.com DISCARD
5.启动sendmail
service sendmail restart
service dovecot restart
chkconfig dovecot on
chkconfig sendmail on
注意:防火墙和selinux关闭
iptables -F
iptables -X
service iptables save
[root@mail mail]#vim /etc/selinux/config
SELINUX=disabled
6.查看端口
[root@mail mail]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:993 0.0.0.0:* LISTEN 4269/dovecot
tcp 0 0 0.0.0.0:995 0.0.0.0:* LISTEN 4269/dovecot
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 4269/dovecot
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 4269/dovecot
tcp 0 0 0.0.0.0:687 0.0.0.0:* LISTEN 2625/rpc.statd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2585/portmap
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2980/httpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2907/sshd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 2941/sendmail
7.安装openwebmail
7.1 配置openwebmail yum
# cd /etc/yum.repos.d
# wget -q http://openwebmail.org/openwebmail/download/redhat/rpm/release/openwebmail.repo
7.2 下载依赖安装包
# wget http://www.openwebmail.org/openwebmail/download/redhat/rpm/packages/rhel5/perl-Text-Iconv/x86_64/perl-Text-Iconv-1.7-1.el5.rf.x86_64.rpm
rpm -ivh perl-Text-Iconv-1.7-1.el5.rf.x86_64.rpm
7.3 安装openwebmail
# yum install openwebmail
fedora 100% |=========================| 2.1 kB 00:00
openwebmail 100% |=========================| 951 B 00:00
updates 100% |=========================| 2.3 kB 00:00
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package openwebmail.i386 0:2.53-1 set to be updated
--> Processing Dependency: openwebmail-data = 2.53-1 for package: openwebmail
--> Processing Dependency: perl-suidperl for package: openwebmail
--> Processing Dependency: perl-Text-Iconv for package: openwebmail
--> Running transaction check
---> Package openwebmail-data.i386 0:2.53-1 set to be updated
---> Package perl-suidperl.i386 4:5.8.8-32.fc8 set to be updated
---> Package perl-Text-Iconv.i386 0:1.5-1.fc8 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing for dependencies:
openwebmail i386 2.53-1 openwebmail 2.3 M
openwebmail-data i386 2.53-1 openwebmail 7.0 M
perl-Text-Iconv i386 1.5-1.fc8 fedora 20 k
perl-suidperl i386 4:5.8.8-32.fc8 updates 60 k
Transaction Summary
=============================================================================
Install 4 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 9.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): perl-Text-Iconv-1. 100% |=========================| 20 kB 00:00
(2/4): openwebmail-2.53-1 100% |=========================| 2.3 MB 00:03
(3/4): perl-suidperl-5.8. 100% |=========================| 60 kB 00:00
(4/4): openwebmail-data-2 100% |=========================| 7.0 MB 00:10
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID cfb164d8
Importing GPG key 0xCFB164D8 "Thomas Chung <tchung@openwebmail.org>" from http://openwebmail.org/.../RPM-GPG-KEY-openwebmail
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: perl-Text-Iconv ######################### [1/4]
Installing: perl-suidperl ######################### [2/4]
Installing: openwebmail ######################### [3/4]
Permission and Ownership for openwebmail files have been fixed!
7.4 配置openwebmail.conf
[root@mail etc]# pwd
/var/www/cgi-bin/openwebmail/etc/openwebmail.conf
cp /var/www/cgi-bin/openwebmail/etc/openwebmail.conf /var/www/cgi-bin/openwebmail/etc/openwebmail.conf_ori
7.41 配置openwebmail
1.openwebmail.conf
vim /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
14行 domainnames maxmell.com.cn
65行 default_language en 修改成--> default_language zh_TW.Big5
85行 default_iconset Cool3D.English 修改成--> default_iconset Cool3D.Chinese.Traditional
76行 <default_signature>
77行 --
78行 Open WebMail Project (http://openwebmail.org)
79行 </default_signature>
此四行是使用者寄信的预设签名文件,请自行修改
2.
216行 webdisk_rootpath /webdisk 修改成--> webdisk_rootpath /
3.dbm.conf
vim /var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf
[root@mail etc]# cat dbm.conf
dbm_ext .pag
dbmopen_ext none
dbmopen_haslock yes
4.auth_unix.conf
[root@mail etc]# cat auth_unix.conf
#
# config file for auth_unix.pl
#
# Red Hat, Fedora and CentOS
passwdfile_plaintext /etc/passwd
passwdfile_encrypted /etc/shadow
passwdmkdb none
check_expire no
check_nologin no
check_shell no
check_cobaltuser no
change_smbpasswd no
5. 初始化openwebmail
Please execute following tool first as a root:
/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init
After restarting httpd service, login with non-root account from
http://localhost.localdomain/cgi-bin/openwebmail/openwebmail.pl
or http://localhost.localdomain/webmail
If SELinux enabled, you may need to set it ‘permissive‘ in
/etc/sysconfig/selinux or system-config-selinux
Installing: openwebmail-data ######################### [4/4]
Dependency Installed: openwebmail.i386 0:2.53-1 openwebmail-data.i386 0:2.53-1 perl-Text-Iconv.i386 0:1.5-1.fc8 perl-suidperl.i386 4:5.8.8-32.fc8
Complete!
8.安装http
yum install http
[root@mail conf]# pwd
/etc/httpd/conf
vim httpd.conf
ServerName localhost:80
9.邮件迁移:
9.1 添加邮件账户
[root@mail ~]# cat add_mail_user.sh
while read name; do
useradd $name
echo "$name" | passwd --stdin $name
done <jianing_mail.txt
9.2 筛选邮件账户
cut -d : -f1 passwd >jianing_mail.txt
最后执行脚本add_mail_user.sh
9.3 将/home 打包
tar -cvf home.tar home/
9.4 将收件箱打包
[root@mail spool]# pwd
/var/spool
tar -cvf mail.tar mail/
9.5 .将home.tar 和mail.tar 解压到对应目录
10.安装配置dns
[root@mail conf.d]# rpm -qa |grep bind
bind-9.3.6-20.P1.el5_8.6
bind-libs-9.3.6-20.P1.el5_8.6
bind-utils-9.3.6-20.P1.el5_8.6
ypbind-1.19-12.el5_6.1
yum install bind bind-lib bind-utils -y
到/etc 目录下面将named.conf 上传
到/var 目录下面将named.tar 上传解压 注意权限
[root@mail etc]# ll named.conf
-rw-r----- 1 root named 2439 Jul 15 23:35 named.conf
[root@mail var]# pwd
/var
[root@mail var]# ll named
total 88
-rw-r----- 1 root named 524 Jul 15 23:12 172.168.1.zone
-rw-r--r-- 1 root named 883 Jul 15 23:25 192.168.0
-rw-r--r-- 1 root named 846 Jul 15 23:26 210.13.193
drwxr-x--- 3 root named 4096 Jul 15 23:11 chroot
drwxrwx--- 2 named named 4096 Jul 13 03:08 data
-rw-r--r-- 1 root named 609 Jul 15 23:30 dilina.com.cn
-rw-r--r-- 1 root named 440 Jul 15 23:31 dns.tairjiuh.com.cn
drwxr-x--- 2 root named 4096 May 29 11:41 dynamic
-rw-r----- 1 root named 536 Jul 15 23:12 mageedu.com.zone
-rw-r--r-- 1 root named 584 Jul 15 23:30 maxartist.com.cn
-rw-r--r-- 1 root named 705 Jul 15 23:31 maxmell.cn
-rw-r--r-- 1 root named 889 Jul 15 23:30 maxmell.com.cn
-rw-r--r-- 1 root named 694 Jul 15 23:27 minjiali.com.cn
-rw-r--r-- 1 root named 415 Jul 15 23:18 named.broadcast
-rw-r----- 1 root named 1892 Feb 18 2008 named.ca
-rw-r----- 1 root named 152 Dec 15 2009 named.empty
-rw-r----- 1 root named 152 Jun 21 2007 named.localhost
-rw-r----- 1 root named 168 Dec 15 2009 named.loopback
-rw-r--r-- 1 root named 416 Jul 15 23:21 named.zero
drwxrwx--- 2 named named 4096 Jan 21 01:40 slaves
-rw-r--r-- 1 root named 2106 Jul 16 00:17 tairjiuh.com.cn
-rw-r--r-- 1 root named 536 Jul 15 23:34 tairjiuh.com.tw
[root@mail named]# /etc/init.d/named start
Starting named: [ OK ]
[root@mail named]# cat /etc/resolv.conf
nameserver 192.168.1.236--修改本地DNS名字
测试解析
[root@mail named]# dig -t A dns.tairjiuh.com.tw.
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-20.P1.el5_8.6 <<>> -t A dns.tairjiuh.com.tw.
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42179
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;dns.tairjiuh.com.tw. IN A
;; ANSWER SECTION:
dns.tairjiuh.com.tw. 86400 IN A 59.120.97.103
;; AUTHORITY SECTION:
tairjiuh.com.tw. 86400 IN NS dns.tairjiuh.com.tw.
;; Query time: 1 msec
;; SERVER: 192.168.1.236#53(192.168.1.236)
;; WHEN: Wed Jul 16 17:34:32 2014
;; MSG SIZE rcvd: 67
本文出自 “steven 业精于勤荒于嬉..” 博客,请务必保留此出处http://steven2.blog.51cto.com/855881/1438989
centos5.10 sendmail+openwebmail,布布扣,bubuko.com
centos5.10 sendmail+openwebmail
原文地址:http://steven2.blog.51cto.com/855881/1438989