suse架设postfix邮件服务器
2014-04-25 18:19
197 查看
环境:
Suse Linux Enterprise Server 11(x86_64) SP1
Postfix 需要安装的组件
套 件 名 稱 | 簡 單 描 述 |
postfix | SMTP Server 的主要套件。 |
qpopper | POP3 Server 的主要套件。 |
zypper install postfix
suse使用qpopper来作为pop3工具,qpopper 自行下载
rpm -ivh [b]qpopper-4.0.14-1.1.x86_64.rpm[/b]
Tips:欲架設具認證功能的郵件主機時,尚需多裝 cyrus-sasl及cyrus-sasl-saslauthd這兩個套件。
如果你没有域名,可以通过下面:
1.修改邮件服务器的hosts文件
vim /etc/hosts
在文件中添加
127.0.0.1 yourdomain.com
2.修改测试客户端的hosts文件
以管理员权限运行一个文本编辑器,打开"C:\Windows\System32\drivers\etc\hosts",在里面添加
192.168.0.114 yourdomain.com
檢視套件內容
suse:~ # rpm -ql postfix
|
/usr/sbin/postconf: | |||
此為 Postfix 的設定工具,可以用來列出 Postfix 的預設參數及實際參數值,也可以直接在命令列上編輯設定參數,並將結果寫入 main.cf 中。舉例如下:
| |||
/usr/sbin/postfix: | |||
這是 postfix 的控管程式,可用來啟動、停止、重新載入 postfix 服務。舉例如下:
|
設定開機時啟動 Postfix 服務
suse:~ # chkconfig postfix 35 |
這一小節會先設定一些 Postfix 的基本參數,等 Postfix 能正常運作之後,再來進一步探討其他的參數設定。另外這裡是把 SMTP 及 POP3 Server 都架設在同一部主機上,這樣在實作上也會比較單純及方便。
設定 SMTP Server
suse:/etc/postfix #vi main.cf # The queue_directory specifies the location of the Postfix queue. queue_directory = /var/spool/postfix # 這是佇留信件所存放的目錄位置。 # The command_directory parameter specifies the location of all postXXX commands. command_directory = /usr/sbin # 指定所有 postxxx 指令 (如 postfix、postalias、postconf 等) 所存放的目錄位置。 # The daemon_directory parameter specifies the location of all Postfix daemon programs # (i.e. programs listed in the master.cf file). This directory must be owned by root. daemon_directory = /usr/lib/postfix # 指定所有 Postfix 相關 daemon 所存放的目錄位置。 # The mail_owner parameter specifies the owner of the Postfix queue and of most # Postfix daemon processes. mail_owner = postfix # 指定 Postfix 佇列目錄的擁有者及大部分 Postfix daemon 程序的執行身分。 # The myhostname parameter specifies the internet hostname of this mail system. # $myhostname is used as a default value for many other configuration parameters. myhostname = mta.paching.idv.tw # 指定您 Mail Server在 Internet 上的完整主機名稱。 # The mydomain parameter specifies the local internet domain name. # The default is to use $myhostname minus the first component. # $mydomain is used as a default value for many other configuration parameters. mydomain = paching.idv.tw # 指定本地端的網域名稱,也就是把 $myhostname去除最前頭的 Short hostname 即是。 # 如果 myhostname 設定為 paching.idv.tw,那 mydomain 就是 idv.tw。 # For the sake of consistency between sender and recipient addresses,myorigin also # specifies the default domain name that is appended to recipient addresses that # have no @domain part. myorigin = $mydomain # 當您在 Postfix 主機上發信時,在對方收到信件後,會顯示寄件者的郵件地址為 # xx@[$myorigin],以這裡來說就是 xx@paching.idv.tw。 # 另外要直接指派也行:# myorigin = paching.idv.tw # 如果您有設定郵件別名 (參考 17.4 節) 時,也會使用到這個參數的設定。 # The inet_interfaces parameter specifies the network interface addresses that this mail # system receives mail on. By default, the software claims all active interfaces on the # machine. # Note: you need to stop/start Postfix when this parameter changes. inet_interfaces = all # 指定在郵件主機上,允許接收信件的網路介面位址。all是表示所有網路介面都可以 # 接收使用者所寄來的信件,這也是預設值。 # 另外當您修改了這個參數後,需要重新啟動 Postfix,而不是重新載入。 # The mydestination parameter specifies the list of domains that this machine considers # itself the final destination for. mydestination = $mydomain # Mail Server 是否會將此封信當成本地端的信件來處理,就是靠這個參數來決定的。比如 # 以這裡的設定來說,只要收到的信件地址是 xxx@paching.idv.tw,則此 MTA 都會視為 # 本地端的信件。如您有多個網域名稱時,在這些名稱之間可使用空白鍵或「,」隔開。 # By default (mynetworks_style = subnet), Postfix "trusts" SMTP clients in the same IP # subnetworks as the local machine. # Specify "mynetworks_style = class" when Postfix should "trust" SMTP clients in the # same IP class A/B/C networks as the local machine. # Specify "mynetworks_style = host" when Postfix should "trust" only the local machine. mynetworks_style = subnet # 指定 SMTP所信任的來源端類型,至於可以指定的類型有以下三種: # mynetworks_style = subnet # 只要與 MTA位於同一個子網段的主機,其所寄過來的信件都允許 Relay。此乃預設。 # mynetworks_style = class #只要與 MTA位於同一 IP 類型 (Class A/B/C) 的主機,其所寄過來的信件都允許 Relay。 # mynetworks_style = host #只允許本機 Relay,也就是只能在郵件主機上來寄信的意思。 # Alternatively, you can specify the mynetworks list by hand, in which case Postfix ignores # the mynetworks_style setting. # Specify an explicit list of network/netmask patterns, where the mask specifies the number # of bits in the network part of a host address. mynetworks = 192.168.1.0/24,127.0.0.0/8 # 指定 SMTP 所信任的來源端位址。以這裡的設定來說,只要是從 192.168.1.0/24 這個 # 網路段所寄過來的信件,或是直接在本機寄信時,都允許 Relay。 # 另外當 mynetworks_style及 mynetworks 同時做設定時,mynetworks_style 會被忽略掉。 always_bcc = david@paching.idv.tw # 這個參數可將 postfix所有收發的信件,利用密件副本的方式寄給其後所指定的帳號。 message_size_limit = 10240000 # 設定每封信件大小不得超過 10 MB。 |
不然telnet IP 110时,收不到邮件,会出现has 0 visible message 或者你使用outlook等客户端时收不到邮件,
以上就是一些基本的設定參數。如您 Postfix 目前尚未啟動,則請使用以下任何一種方式來啟動吧:
suse:~ #/etc/init.d/postfix start suse:~ # rcpostfix start suse:~ # postfix start |
SMTP 啟動之後的檢查
1. 本機使用 netstat 或 ps 指令檢查:
suse:~ # netstat -anp | grep :25 tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 11348/master ↑ 這裡如果顯示 127.0.0.1 的話,表示不能對外提供 smtp 服務,請您特別留意一下。 suse:~ # ps aux | grep master root 11348 0.0 0.5 4736 1432 ? Ss 18:17 0:00 /usr/lib/postfix/master |
3. Client 端使用 telnet 測試:
Windows Client 的測試 | ||
| ||
Linux Client 的測試 (順便模擬與 SMTP 的對話) | ||
|
目前這台 Mail Server 只能提供寄信的服務,還不能提供給您的 Client 端收信,所以趕快去設定一下 POP3 就行了。POP3 服務是靠 xinetd 來啟動的,因此待會兒做完修改後,請記得重新啟動 xinetd。
suse:~ # vi /etc/xinetd.d/qpopper service pop3 { disable = no ←原本為 yes,改成 no 即可。 socket_type = stream protocol = tcp wait = no user = root server = /usr/sbin/popper server_args = -s flags = IPv4 } suse:~ # rcxinetd restart |
1. 本機使用 netstat 指令檢查:
suse:~ # netstat -anp | grep :110 tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 12082/xinetd |
3. Client 端使用 telnet 測試:
Windows Client 的測試 | ||
| ||
Linux Client 的測試 (順便模擬與 POP3 的對話) | ||
|
转载参考:
http://www.suse.url.tw/sles10/lesson17.htm http://blog.csdn.net/dotuian/article/details/8552418
相关文章推荐
- postfix和dovecot架设邮件服务器的一些记录1
- 教你如何架设linux邮件服务器postfix
- 继续摘抄:Postfix+Dovecot邮件服务器架设傻瓜版指南
- 我的postfix+postfixadmin邮件服务器架设过程
- postfix+postfixadmin+extmail邮件服务器架设过程
- Postfix邮件服务器架设
- 手把手教您linux下邮件服务器Postfix的架设
- 搭建Linux下邮件服务器(extmail+postfix+clamav)
- 构建Postfix邮件服务器
- 3.架设邮件服务器-第三方软件(hMailServer)
- SMTP邮件服务器postfix配置与使用
- 整理一下杂七杂八的postfix+extmail的mail服务器架设维护笔记
- 阿里云CentOS Linux服务器上用postfix搭建邮件服务器
- Linux系统下邮件服务器的搭建(Postfix+Dovecot)
- postfix全功能邮件服务器配置
- ·RHEL4上搭建基于postfix的全功能邮件服务器(续前篇)
- 上海某重点院校邮件服务器架设方案
- yum安装postfix邮件服务器
- Win 2003架设邮件服务器
- 用 Win2003 架设邮件服务器