1. 1.解压sendmail 
  2. [root@localhost monitor]# tar zxvf sendmail.8.14.5.tar.gz -C /usr/local/src
  3. 2.删除系统自带的sendmail,并检查sasl库是否安装
  4. [root@localhost monitor]# rpm -e --nodeps sendmail
  5. [root@localhost monitor]# rpm -qa|grep sasl
  6. 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
  7. 3.编写site.config.m4宏文件,该文件默认不存在,需手动创建。
  8. devtools/Site/site.config.m4.sample可作为参考
  9. [root@localhost sendmail-8.14.5]# vi devtools/Site/site.config.m4
  10. 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')
  11. 4.编译sendmail
  12. [root@localhost sendmail-8.14.5] cd sendmail/
  13. [root@localhost sendmail] sh ./Build -c
  14. 5.进入cf/cf目录,根据操作系统的类型复制一个mc的模板文件,复制后的文件名为:sendmail.mc
  15. ,然后编译生成sendmail.cf文件。
  16. [root@localhost sendmail-8.14.5] cd cf/cf/
  17. [root@localhost cf] cp generic-linux.mc sendmail.mc
  18. [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
  19. 6.安装sendmail.cf到/etc/mail目录下
  20. [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
  21. 7.复制sendmail.mc宏文件到/etc/mail目录下,该操作不是必须的,但以后配置sendmail是会修改该宏文件
  22. [root@localhost cf]# cp sendmail.mc /etc/mail/
  23. 8.复制m4目录到/etc/mail目录下,执行m4命令需要使用该目录下的文件
  24. [root@localhost sendmail-8.14.5]# cp -R cf/* /etc/mail
  25. 9.切换到sendmail源代码所在的目录下,开始安装sendmail主程序
  26. [root@localhost sendmail-8.14.5]# pwd /usr/local/src/sendmail-8.14.5
  27. [root@localhost sendmail-8.14.5]# mkdir /usr/man/man{1,5,8}
  28. [root@localhost sendmail-8.14.5]# ./Build install
  29. 10.进入/etc/mail目录,创建aliases与access文件
  30. [root@localhost sendmail-8.14.5]# cd /etc/mail
    [root@localhost mail]# touch aliases access
  31. 11.将DNS的域名于邮件服务器的主机名追加到local-host-names文件,该文件决定了电子邮件的地址,邮件服务器
  32. 为哪个域而工作。
  33. [root@localhost mail]# echo "gicp.net" >local-host-names
    [root@localhost mail]# echo "brokensmile.gicp.net" >>local-host-names
  34. 12.将access文件转化成.db数据库文件,完成后产生一个access.db的数据文件
  35. [root@localhost mail]# makemap hash access < access
    makemap: Need to recompile with -DNEWDB for hash support
  36.  
  37.  
  38.