- 1.解压sendmail
- [root@localhost monitor]# tar zxvf sendmail.8.14.5.tar.gz -C /usr/local/src
- 2.删除系统自带的sendmail,并检查sasl库是否安装
- [root@localhost monitor]# rpm -e --nodeps sendmail
- [root@localhost monitor]# rpm -qa|grep sasl
- cyrus-sasl-2.1.23-8.el6.i686
cyrus-sasl-plain-2.1.23-8.el6.i686
cyrus-sasl-lib-2.1.23-8.el6.i686
cyrus-sasl-devel-2.1.23-8.el6.i686 - 3.编写site.config.m4宏文件,该文件默认不存在,需手动创建。
- devtools/Site/site.config.m4.sample可作为参考
- [root@localhost sendmail-8.14.5]# vi devtools/Site/site.config.m4
- APPENDDEF(`confENVDEF',`-DSASL')dnl
APPENDDEF(`confLIBS',`-lsasl2')dnl
APPENDDEF(`confINCDIRS',`-I/usr/include/sasl')dnl
APPENDDEF(`confMAPDEF',`-DNEWDB') APPENDDEF(`confLIBS', `-ldb') APPENDDEF(`confINCDIRS', `-I/usr/local/BerkeleyDB.5.1/include') APPENDDEF(`confLIBDIRS', `-L/usr/local/BerkeleyDB.5.1/lib')define(`confMANGRP',`root')
define(`congMANOWN',`root')
define(`confSBINGRP',`root')
define(`confUBINGRP',`root')
define(`confUBINGRP',`root') - 4.编译sendmail
- [root@localhost sendmail-8.14.5] cd sendmail/
- [root@localhost sendmail] sh ./Build -c
- 5.进入cf/cf目录,根据操作系统的类型复制一个mc的模板文件,复制后的文件名为:sendmail.mc
- ,然后编译生成sendmail.cf文件。
- [root@localhost sendmail-8.14.5] cd cf/cf/
- [root@localhost cf] cp generic-linux.mc sendmail.mc
- [root@localhost cf]# ./Build sendmail.cf
Using M4=/usr/bin/m4
rm -f sendmail.cf
/usr/bin/m4 ../m4/cf.m4 sendmail.mc > sendmail.cf || ( rm -f sendmail.cf && exit 1 )
echo "### sendmail.mc ###" >>sendmail.cf
sed -e 's/^/# /' sendmail.mc >>sendmail.cf chmod 444 sendmail.cf - 6.安装sendmail.cf到/etc/mail目录下
- [root@localhost cf]# ./Build install-cf
Using M4=/usr/bin/m4
../../devtools/bin/install.sh -c -o root -g bin -m 0444 sendmail.cf /etc/mail/sendmail.cf
../../devtools/bin/install.sh -c -o root -g bin -m 0444 submit.cf /etc/mail/submit.cf - 7.复制sendmail.mc宏文件到/etc/mail目录下,该操作不是必须的,但以后配置sendmail是会修改该宏文件
- [root@localhost cf]# cp sendmail.mc /etc/mail/
- 8.复制m4目录到/etc/mail目录下,执行m4命令需要使用该目录下的文件
- [root@localhost sendmail-8.14.5]# cp -R cf/* /etc/mail
- 9.切换到sendmail源代码所在的目录下,开始安装sendmail主程序
- [root@localhost sendmail-8.14.5]# pwd /usr/local/src/sendmail-8.14.5
- [root@localhost sendmail-8.14.5]# mkdir /usr/man/man{1,5,8}
- [root@localhost sendmail-8.14.5]# ./Build install
- 10.进入/etc/mail目录,创建aliases与access文件
- [root@localhost sendmail-8.14.5]# cd /etc/mail
[root@localhost mail]# touch aliases access - 11.将DNS的域名于邮件服务器的主机名追加到local-host-names文件,该文件决定了电子邮件的地址,邮件服务器
- 为哪个域而工作。
- [root@localhost mail]# echo "gicp.net" >local-host-names
[root@localhost mail]# echo "brokensmile.gicp.net" >>local-host-names - 12.将access文件转化成.db数据库文件,完成后产生一个access.db的数据文件
- [root@localhost mail]# makemap hash access < access
makemap: Need to recompile with -DNEWDB for hash support
转载于:https://blog.51cto.com/brokensmile/649474