在Linux系统下面架设Sendmail服务器
架设sendmail服务器这次我们来学习Linux系统中的Sendmail服务器的配置。(邮件服务器的IP192.168.1.2主机域名为mail.ltest.com)前提:首先我们把DNS服务器安装OK能够解析,不明白的看,首先安装Sendmail所需软件[root@localhost~]#rpm-qsendmailm4sendmail-8.13.1-2m4-1.4.1-16已经默认安装了,还需挂载第4张光盘,安装与sendmail相关的软件[root@localhostRPMS]#rpm-ivhsendmail-*warning:sendmail-cf-8.13.1-2.i386.rpm:V3DSAsignature:NOKEY,keyIDdb42a60ePreparing...###########################################[100%]1:sendmail-doc###########################################[33%]2:sendmail-cf###########################################[67%]3:sendmail-devel###########################################[100%]2.修改/etc/mail/local-hosts-name文件。增加本地域和主机的FQDN,记住只是本地主机的FQDN和域名FQDN,不要添加其他域的,否则向外域发送邮件的时候会出现userunknown的错误:[root@localhostnamed]#cat/etc/mail/local-host-names#local-host-names-includeallaliasesforyourmachinehere.ltest.com3,更改/etc/mail/sendmail.mc文件,修改下列地方:DaemonPortsOptions=Port=smtp,Addr=127.0.0.1,Name=MTA更改为:DaemonPortsOptions=Port=smtp,Addr=yourip或者0.0.0.0,Name=MTA然后m4/etc/mail/sendmail.mc>/etc/mail/sendmail.cf4,用户管理认证的配置:修改/etc/mail/sendmail.mc中的字段,取消“TRUST_AUTH_MECH”一行和下一行“define”处的注释。(于sendmail.mc文件的第48、49)然后m4/etc/mail/sendmail.mc>/etc/mail/sendmail.cf。[root@localhostnamed]#chkconfig--listsaslauthd开启认证saslauthd0:off1:off2:off3:off4:off5:off6:off[root@localhostnamed]#chkconfig--level35saslauthdon建立用户帐号[root@localhostnamed]#groupaddmailuser[root@localhostnamed]#adduser-gmailuser-s/sbin/nologinmike[root@localhostnamed]#adduser-gmailuser-s/sbin/nologinjohn[root@localhostnamed]#passwdmike[root@localhostnamed]#passwdjohn密码都是123设置邮件别名和邮件群发修改/etc/aliases文件实现邮件转发和邮件列表:admin:mike为邮件用户mike设置别名admintestgroup:mike,john实现群发发给testgroup的邮件发给mike和john以上2个可以分别测试#newaliases5,访问控制设置更改/etc/mail/accesss文件,增加:[root@localhostnamed]#cat/etc/mail/access#Checkthe/usr/share/doc/sendmail/README.cffileforadescription#oftheformatofthisfile.(searchforaccess_dbinthatfile)#The/usr/share/doc/sendmail/README.cfispartofthesendmail-doc#package.##bydefaultweallowrelayingfromlocalhost...localhost.localdomainRELAYlocalhostRELAY127.0.0.1RELAYltest.comRELAY完成后makemaphash/etc/mail/access.db</etc/mail/access进行数据库更新。
6,#servicesendmailrestart[root@localhostnamed]#servicesendmailrestart启动服务Shuttingdownsendmail:[FAILED]Startingsendmail:[OK]Startingsm-client:[OK][root@localhostnamed]#telnetlocalhost25Trying127.0.0.1...Connectedtolocalhost.localdomain(127.0.0.1).Escapecharacteris'^]'.220localhost.localdomainESMTPSendmail8.13.1/8.13.1;Sat,17Mar200712:54:47+0800ehlolocalhost250-localhost.localdomainHellolocalhost.localdomain[127.0.0.1],pleasedtomeetyou250-ENHANCEDSTATUSCODES250-PIPELINING250-8BITMIME250-SIZE250-DSN250-ETRN250-AUTHDIGEST-MD5CRAM-MD5LOGINPLAIN---认证应该生效250-DELIVERBY250HELPquit2212.0.0localhost.localdomainclosingconnectionConnectionclosedbyforeignhost.7,安装邮局服务[root@localhostRPMS]#rpm-ivhdovecot-0.99.11-2.EL4.1.i386.rpm--aidwarning:dovecot-0.99.11-2.EL4.1.i386.rpm:V3DSAsignature:NOKEY,keyIDdb42a60ePreparing...###########################################[100%]1:perl-DBI###########################################[20%]2:postgresql-libs###########################################[40%]3:mysql###########################################[60%]4:dovecot###########################################[80%]5:perl-DBD-MySQL###########################################[100%]把1-5这些软件都安装完毕才可以继续下去呢,,,,[root@localhost/]#vi/etc/dovecot.conf在protocols=imapimaps后添加pop3pop3s启动dovecot服务[root@localhost/]#servicedovecotrestartStoppingDovecotImap:[FAILED]StartingDovecotImap:[OK][root@localhost/]#chkconfig--level35dovecotonOK了我们使用客户机测试。(T002)