RHEL4系統Sendmail郵件伺服器的架設
轉載:http://linux.chinaitlab.com/server/726302_2.html
這次我們來學習Linux系統中的Sendmail伺服器的配置。(郵件伺服器的IP192.168.1.2 主機域名為mail.ltest.com)
前提:首先我們 把DNS伺服器安裝OK 能夠解析,不明白的看http://linux.chinaitlab.com/server/725027.html
1.首先安裝Sendmail所需軟體
# rpm -q sendmail m4
sendmail-8.13.1-2
m4-1.4.1-16 已經默認安裝了,還需掛載第4張光碟,安裝與sendmail相關的軟體
# rpm -ivh sendmail-*
warning: sendmail-cf-8.13.1-2.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing…… ###########################################
1:sendmail-doc ########################################### [ 33%]
2:sendmail-cf ########################################### [ 67%]
3:sendmail-devel ###########################################
2.修改/etc/mail/local-hosts-name文件。
增加本地域和主機的FQDN,記住只是本地主機的FQDN和域名FQDN,不要添加其他域的,否則向外域發送郵件的時候會出現user unknown的錯誤:
# cat /etc/mail/local-host-names
# local-host-names - include all aliases for your machine here.
ltest.com
3.更改/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.cf
4.用戶管理
認證的配置:修改/etc/mail/sendmail.mc中的欄位,取消「TRUST_AUTH_MECH」一行和下一行「define」處的註釋。(於sendmail.mc文件的第48、49)然後m4 /etc/ mail/sendmail.mc>/etc/mail/sendmail.cf。
# chkconfig ——list saslauthd 開啟認證
saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# chkconfig ——level 35 saslauthd on
建立用戶帳號
# groupadd mailuser
# adduser -g mailuser -s /sbin/nologin mike
# adduser -g mailuser -s /sbin/nologin john
# passwd mike
# passwd john 密碼都是123
設置郵件別名和郵件群發
修改/etc/aliases文件實現郵件轉發和郵件列表:
admin: mike 為郵件用戶mike設置別名admin
testgroup: mike,john 實現群發 發給testgroup的郵件發給mike 和 john 以上2個可以分別測試
#newaliases
5.訪問控制設置
更改/etc/mail/accesss文件,增加:
# cat /etc/mail/access
# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost……
localhost.localdomain RELAY
localhost RELAY
127.0.0.1 RELAY
ltest.com RELAY
完成後makemap hash /etc/mail/access.db < /etc/mail/access進行資料庫更新。
6.#service sendmail restart
# service sendmail restart 啟動服務
Shutting down sendmail:
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
# 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.1/8.13.1; Sat, 17 Mar 2007 12:54:47 +0800
ehlo localhost
250-localhost.localdomain Hello localhost.localdomain , pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN ——認證應該生效
250-DELIVERBY
250 HELP
quit
221 2.0.0 localhost.localdomain closing connection
Connection closed by foreign host.
7.安裝郵局服務
# rpm -ivh dovecot-0.99.11-2.EL4.1.i386.rpm ——aid
warning: dovecot-0.99.11-2.EL4.1.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing…… ###########################################
1:perl-DBI ########################################### [ 20%]
2:postgresql-libs ########################################### [ 40%]
3:mysql ########################################### [ 60%]
4:dovecot ########################################### [ 80%]
5:perl-DBD-MySQL ###########################################
把1-5這些軟體都安裝完畢才可以繼續下去呢,,,,
# vi /etc/dovecot.conf在protocols = imap imaps 后添加pop3 pop3s
啟動dovecot服務
# service dovecot restart
Stopping Dovecot Imap:
Starting Dovecot Imap: [ OK ]
# chkconfig ——level 35 dovecot on
OK了 我們使用客戶機測試。
[火星人
]
RHEL4系統Sendmail郵件伺服器的架設已經有550次圍觀
http://coctec.com/docs/service/show-post-37364.html