/ 中存储网

centos 5.4系统下配置sendmail服务器

2014-08-12 09:16:57 来源:中存储网

[root@localhost ~]# rpm -q sendmail

package sendmail is not installed
[root@localhost ~]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@localhost ~]# cd /mnt/CentOS
[root@localhost CentOS]# ls -l sendmail*
-rw-rw-r-- 1 500 500 646709 2007-11-19 sendmail-8.13.8-2.el5.i386.rpm             #sendmail服务器程序
-rw-rw-r-- 1 500 500 318671 2007-11-19 sendmail-cf-8.13.8-2.el5.i386.rpm          #与sendmail服务器相关的一系列配置文件和程序
-rw-rw-r-- 1 500 500 131633 2007-11-19 sendmail-devel-8.13.8-2.el5.i386.rpm      #sendmail的开发库
-rw-rw-r-- 1 500 500 668959 2007-11-19 sendmail-doc-8.13.8-2.el5.i386.rpm         #sendmail服务器的文档
[root@localhost CentOS]# rpm -ivh sendmail-8.13.8-2.el5.i386.rpm
warning: sendmail-8.13.8-2.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
1:sendmail               ########################################### [100%]
[root@localhost CentOS]# rpm -ivh sendmail-cf-8.13.8-2.el5.i386.rpm
warning: sendmail-cf-8.13.8-2.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
1:sendmail-cf            ########################################### [100%]
安装Dovecot 软件包(POP3 和IMAP)
到这里sendmail 服务器基本配置完成后,Mail Server 就可以完成邮件发送工作,如果需要使用
POP3 和IMAP 协议接收邮件还需要安装dovecot 软件包。在rhel5 里dovecot 整合了IMAP。
安装dovecot 软件包要解决其依赖性,安装perl-DBI-1.52-2.el5.i386.rpm、mysql-5.0.77-3.el5.i386.rpm和
dovecot-1.0.7-7.el5.i386.rpm
[root@localhost CentOS]# rpm -ivh perl-DBI-1.52-2.el5.i386.rpm
warning: perl-DBI-1.52-2.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
1:perl-DBI               ########################################### [100%]
[root@localhost CentOS]# rpm -ivh mysql-5.0.77-3.el5.i386.rpm
warning: mysql-5.0.77-3.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
1:mysql                  ########################################### [100%]
[root@localhost CentOS]# rpm -ivh dovecot-1.0.7-7.el5.i386.rpm
warning: dovecot-1.0.7-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
1:dovecot                ########################################### [100%]
启动Sendmail 服务
service sendmail restart 和service dovecot restart 命令启动sendmail 和dovecot 服务,
[root@localhost CentOS]# service sendmail restart
测试端口
使用netstat 命令测试是否开启SMTP 的25 端口、POP3 的110 端口及IMAP 的143 端口。
[root@localhost CentOS]# netstat -ntla
Active Internet connections (servers and established)
Proto  Recv-Q   Send-Q   Local Address           Foreign Address          State     
tcp        0            0            :::110                         :::*                              LISTEN     
tcp        0            0            :::143                       :::*                              LISTEN     
tcp        0            0            :::22                           :::*                              LISTEN    
验证Sendmail 的SMTP 认证功能
telnet localhost 25 后输入ehlo localhost 验证Sendmail 的SMTP 认证功能

 [root@localhost CentOS]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 localhost.localdomain ESMTP Sendmail 8.13.8/8.13.8; Thu, 6 Jan 2011 11:06:19 +0800
ehlo localhost
250-localhost.localdomain Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
quit
221 2.0.0 localhost.localdomain closing connection
Connection closed by foreign host.

telnet localhost 110

 [root@localhost CentOS]# telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK Dovecot ready.
quit
+OK Logging out
Connection closed by foreign host.

在WINDOWS系统下telnet 10.10.10.160 25
 
telnet 10.10.10.160 110

建立sendmail服务器用户:

 [root@localhost CentOS]# useradd sdbaby
[root@localhost CentOS]# passwd sdbaby
Changing password for user sdbaby.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@localhost CentOS]# useradd sendmail
[root@localhost CentOS]# passwd sendmail
Changing password for user sendmail.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@localhost CentOS]#

--------------------------------
未完成,
-------------------