/ 中存储网

rhel5系统下的sendmail配置指南

2014-07-13 20:29:30 来源:中存储网
[root@rhel5 Server]# vi /etc/named.conf
// generated by named-bootconf.pl
options {
directory "/var/named";
/*
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
// query-source address * port 53;
};
//
// a caching only nameserver config
//
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
zone "." IN {
type hint;
file "named.ca";
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
zone "abc.com" in {
type master;
file "abc.com.zone";
};
include "/etc/rndc.key"文件末尾加上自己的域名abc.com。
[root@rhel5 Server]# cd /var/named #进入解析文件的目录
[root@rhel5 named]# cp named.local abc.com.zone #生成自己的解析文件
这个时候因为是root权限,但是DNS解析又需要named这个用户,所以把abc.com.zone的拥有着更改为named,如下:
[root@rhel5 named]# chown named.named abc.com.zone
[root@rhel5 named]# vim abc.com.zone
$TTL 86400
@ IN SOA abc.com. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS 192.168.1.95
IN MX 5 mail
mail IN A 192.168.1.95
pop3 IN A 192.168.1.95
smtp IN A 192.168.1.95
服务器的地址为192.168.1.95,DNS地址为本机的IP。
[root@rhel5 named]# nslookup mail.abc.com
Server: 192.168.1.95
Address: 192.168.1.95#53
Name: mail.abc.com
Address: 192.168.1.95

安装sendmail
Sendmail也需要3个包支持
sendmail-8.13.8-2.el5.i386.rpm,sendmail-cf-8.13.8-2.el5.i386.rpm,sendmail-doc-8.13.8-
2.el5.i386.rpm,
把服务器监听地址改为服务器的IP地址:
[root@rhel5 Server]# vim /etc/mail/sendmail.cf
# SMTP daemon options
O DaemonPortOptions=Port=smtp,Addr=192.168.1.95, Name=MTA
# SMTP client options
O ClientPortOptions=Family=inet, Address=192.168.1.95
把sendmail服务器的域名添加进去:
[root@rhel5 Server]# vim /etc/mail/local-host-names
# local-host-names - include all aliases for your machine here.

安装dovecot,在rhel5里dovecot整合了imap。
[root@rhel5 Server]# rpm -ivh dovecot-1.0-1.2.rc15.el5.i386.rpm
[root@rhel5 Server]# service named start
[root@rhel5 Server]# service dovecot start
[root@rhel5 Server]# service sendmail start
[root@rhel5 Server]# chkconfig dovecot on

验证所有的服务全起来了
[root@rhel5 Server]# netstat -ntla
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 192.168.1.95:53 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN
tcp 0 0 192.168.1.95:25 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:697 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN
tcp 0 0 :::993 :::* LISTEN
tcp 0 0 :::995 :::* LISTEN
tcp 0 0 :::110 :::* LISTEN
tcp 0 0 :::143 :::* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::ffff:192.168.1.95:22 ::ffff:192.168.1.101:2603 ESTABLISHED

添加测试用户:
[root@rhel5 Server]# useradd test1
[root@rhel5 Server]# passwd test1
Changing password for user test1.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@rhel5 Server]# useradd test2
[root@rhel5 Server]# passwd test2
Changing password for user test2.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.