RedHat 5.4下构建postfix全功能电子邮(一)-环境(软件包、dns准备)
[root@mail ~]# uname -r
2.6.18-164.el5
准备:关FireWall和SeLinux(略)
1.#下载以下软件(这里我将包放在/soft下了)
[root@mail ~]# cd /soft/
[root@mail soft]# ls
courier-authlib-0.62.4.tar.bz2 mysql-5.0.75.tar.gz
DBD-mysql-4.020.tar.gz mysql-5.0.95-linux-i686-glibc23.tar.gz
DBI-1.616.tar.gz perl-rrdtool-1.2.23-1.el5.rf.i386.rpm
dovecot-1.1.4.tar.gz php-5.4.0alpha1.tar.gz
extmail-1.1.0.tar.gz php-5.4.0.tar.zip
extmail-1.1.1.tar.gz postfix-2.8.2.tar.gz
extmail-1.2.tar.gz python-rrdtool-1.2.23-1.el5.rf.i386.rpm
extman-1.0.1.tar.gz Readme--?+?.htm
extman-1.1.tar.gz rrdtool-1.2.23-1.el5.rf.i386.rpm
File-Tail-0.99.3.tar.gz rrdtool-devel-1.2.23-1.el5.rf.i386.rpm
fp-Linux-i686-ws.tar.gz ruby-rrdtool-1.2.23-1.el5.rf.i386.rpm
GD-2.46.tar.gz squirrelmail-webmail-1.4.22.tar.gz
httpd-2.2.9.tar.gz tcl-rrdtool-1.2.23-1.el5.rf.i386.rpm
MailScanner-4.84.3-1.rpm.tar.gz Unix-Syslog-1.1.tar.gz
[root@mail soft]#
软件包的下载地址:
2.#修改ip地址为10.20.5.35,修改dns指向为10.20.5.35
[root@mail ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
BROADCAST=10.20.5.255
HWADDR=00:0C:29:B7:6C:1C
IPADDR=10.20.5.35
NETMASK=255.255.255.0
NETWORK=10.20.5.0
ONBOOT=yes
[root@mail ~]# service network restart
[root@mail ~]# vim /etc/resolv.conf
nameserver 10.20.5.35
3、安装以下开发所用到的rpm包组:
Development Libraries
Development Tools
Legacy Software Development
X Software Development
#安装方法: yum groupinstall "packge_group_name"
4.构建本地yum服务器(略)
5.安装配置dns服务器:
[root@mail ~]# yum install -y bind bind-chroot caching-nameserver
1.执行(#rpm -ql caching-nameserver)查看named的配置文件
[root@mail ~]# rpm -ql caching-nameserver
/etc/named.caching-nameserver.conf
/etc/named.conf
/etc/named.rfc1912.zones
/usr/share/doc/caching-nameserver-9.3.6
/usr/share/doc/caching-nameserver-9.3.6/Copyright
/usr/share/doc/caching-nameserver-9.3.6/rfc1912.txt
/var/named/chroot/etc/named.caching-nameserver.conf
/var/named/chroot/etc/named.conf
/var/named/chroot/etc/named.rfc1912.zones
/var/named/chroot/var/named/localdomain.zone
/var/named/chroot/var/named/localhost.zone
/var/named/chroot/var/named/named.broadcast
/var/named/chroot/var/named/named.ca
/var/named/chroot/var/named/named.ip6.local
/var/named/chroot/var/named/named.local
/var/named/chroot/var/named/named.zero
/var/named/localdomain.zone
/var/named/localhost.zone
/var/named/named.broadcast
/var/named/named.ca
/var/named/named.ip6.local
/var/named/named.local
/var/named/named.zero
[root@mail ~]#
2.执行(#vi /etc/named.caching-nameserver.conf )修改DNS的主配置文件
15 listen-on port 53 { any; };
27 allow-query { any; };
28 allow-query-cache { any; };
37 match-clients { any; };
38 match-destinations { any; };
3.执行(#vi /etc/named.rfc1912.zones )修改指定区域文件,包括正向区域和反向区域
1)先复制本地的正向区域和反向区域(黑色区域),然后粘贴添加到文件的底部的空白处。
4.创建正向区域和反向区域(如下图)
5.利用本地域正向区域文件,编辑正向区域文件shuiyong1
1)复制正向区域文件(#cp /var/named/localhost.zone /var/named/chroot/var/named/shuiyong1)
2)编辑正向区域文件shuiyong1(#vi /var/named/chroot/var/named/shuiyong1)
6.利用本地域反向区域文件,编辑反向区域文件shuiyong2
1)复制正向区域文件(#cp /var/named/named.local /var/named/chroot/var/named/shuiyong2)
2)编辑正向区域文件shuiyong2(#vi /var/named/chroot/var/named/shuiyong2)
7.把正向和反向两个区域文件做个软链接
[root@mail ~]# ln -s /var/named/chroot/var/named/shuiyong1 /var/named/ shuiyong 1
[root@mail ~]# ln -s /var/named/chroot/var/named/ shuiyong 2 /var/named/ shuiyong 2
8.更改shuiyong*文件的属主和属组
(#chown named:named /var/named/chroot/var/named/ shuiyong *)
9.当配置转换程序(客户端)使用bind域名服务查询主机时,必须告诉转换程序使用哪一个域名服务器,用来完成这项任务的工具就是/etc/resolv.conf文件。
(#vi /etc/resolv.conf )增加如下一行:
nameserver 10.20.5.35 /*指向的是刚配置的DNS服务器*/
10.DNS服务器配置好之后,用下面的命令启动服务器(顺便也关闭一下防火墙):
[root@mail ~]# service named start
[root@mail ~]# service iptables stop
[root@mail ~]# chkconfig named on
[root@mail ~]# service named start
[root@mail ~]# rndc reload
server reload successful
#查看dns解析是否正常
[root@mail ~]# nslookup pop3.shuiyong.com
[root@mail ~]# nslookup mail.shuiyong.com
[root@mail ~]# dig -t mx shuiyong.com
[root@mail ~]# nslookup 10.20.5.35
6.修改主机名称,并重新启动系统,重启后挂载光盘
[root@junjie named]# vim /etc/sysconfig/network
HOSTNAME=mail.shuiyong.com
[root@junjie named]# init 6
[root@mail ~]# mount /dev/cdrom /mnt/cdrom/