由于需要在Linux服务器(Red Hat Enterprise Linux Server release 6.0)上配置邮件服务,需要安装Sendmail包,一般Sendmail的安装有两种方式:RPM包安装方式以及源代码安装方式。在Red Hat平台,一般都习惯使用RPM包安装方式,这个比源代码安装方式要快捷方便一些。
步骤一:首先检测系统是否安装了Sendmail相关包
[root@bogon ~]# rpm -q sendmail
package sendmail is not installed
步骤二:挂载光盘或安装介质
如下所示,安装包一般位于Packages下,挂载好光盘或安装介质后,进入该目录
[root@bogon ~]# cd /mnt/hgfs/relhat6/Packages/
步骤三:开始安装Sendmail相关包
使用ls命令查找Sendmail服务相关的包,如下所示
[root@bogon Packages]# ls sendmail*
sendmail-8.14.4-8.el6.x86_64.rpm sendmail-cf-8.14.4-8.el6.noarch.rpm
注意,最好的方式是使用yum命令安装,这样就能避免rpm安装过程缺少依赖,导致安装需要反复中断的问题,或者你首先需要查看文档资料,将所有依赖的包提前安装好后,然后安装Sendmail相关包,不过下面本着学习、探究的态度,来看看具体过程吧
[root@bogon Packages]# rpm -ivh sendmail-8.14.4-8.el6.x86_64.rpm
warning: sendmail-8.14.4-8.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
libhesiod.so.0()(64bit) is needed by sendmail-8.14.4-8.el6.x86_64
procmail is needed by sendmail-8.14.4-8.el6.x86_64
安装失败,因为sendmail-8.14.4-8.el6.x86_64.rpm需要依赖libhesiod.so.0()(64bit),这时你需要先安装包hesiod-3.1.0-19.el6.x86_64.rpm
[root@bogon Packages]# rpm -ivh hesiod-3.1.0-19.el6.x86_64.rpm
warning: hesiod-3.1.0-19.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:hesiod ########################################### [100%]
[root@bogon Packages]# rpm -ivh sendmail-8.14.4-8.el6.x86_64.rpm
warning: sendmail-8.14.4-8.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
procmail is needed by sendmail-8.14.4-8.el6.x86_64
安装失败,因为sendmail-8.14.4-8.el6.x86_64.rpm需要依赖procmail,这时你需要先安装包procmail-3.22-25.1.el6.x86_64.rpm
[root@bogon Packages]# ls procmail*
procmail-3.22-25.1.el6.x86_64.rpm
[root@bogon Packages]# rpm -ivh procmail-3.22-25.1.el6.x86_64.rpm
warning: procmail-3.22-25.1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:procmail ########################################### [100%]
[root@bogon Packages]#
折腾了两次才搞定,如果这个包依赖N个包,那么要折腾死,看来yum安装才是最快捷的方式
[root@bogon Packages]# rpm -ivh sendmail-8.14.4-8.el6.x86_64.rpm
warning: sendmail-8.14.4-8.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:sendmail ########################################### [100%]
[root@bogon Packages]#
[root@bogon Packages]# rpm -ivh sendmail-cf-8.14.4-8.el6.noarch.rpm
warning: sendmail-cf-8.14.4-8.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:sendmail-cf ########################################### [100%]
[root@bogon Packages]#
接下来需要安装生成配置文件的m4工具包
[root@bogon Packages]# ls m4*
m4-1.4.13-5.el6.x86_64.rpm
[root@bogon Packages]# rpm -ivh m4-1.4.13-5.el6.x86_64.rpm
warning: m4-1.4.13-5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
package m4-1.4.13-5.el6.x86_64 is already installed
[root@bogon Packages]#
在启动服务之前,需要配置sendmail.mc,然后用m4生成sendmail.cf配置文件(其实不用配置也可启动服务,当然如果要能成功发送邮件,那是必须的)
[root@bogon mail]# m4 sendmail.mc > sendmail.cf
[root@bogon mail]#
[root@bogon Packages]# service sendmail start
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
[root@bogon Packages]#