這篇有點欺騙社會的味道,
因為在FreeBSD上安裝postfix實在簡單到不行...
1. cd /usr/ports/mail/postfix24
2. make install clean (選擇你要搭配的資料來源, database or ldap or etc...)
3. 安裝途中會問你
1. You need user "postfix" added to group "mail".
Would you like me to add it [y]?
(問要不要把postfix這個帳號加到mail的群組裡,答"y"即可)
2. Would you like to activate Postfix in /etc/mail/mailer.conf [n]? y
(是否要把postfix加到mailer.conf裡, 答"y")
安裝完後會提示你
1. To enable postfix startup script please add postfix_enable="YES" in your rc.conf
( 在rc.conf裡加一行"postfix_enable="YES" 以便開機時自動啟動)
2. If you not need sendmail anymore, please add in your rc.conf:
( 如果你不在需要sendmail, 參考以下設定來修改你的rc.conf )
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
And you can disable some sendmail specific daily maintenance routines in your /etc/periodic.conf file:
( 你還可以在/etc/periodic.conf裡關掉某些sendmail才會用到的設定 )
daily_clean_hoststat_enable="NO"
daily_status_mail_rejects_enable="NO"
daily_status_include_submit_mailq="NO"
daily_submit_queuerun="NO"
這樣就算安裝完成...接下來是這定
主要的設定都在/usr/local/etc/postfix/main.cf下,其他的設定檔也都在這個目錄中
1. 把以下加進main.cf
-----begin-----
myhostname = 主機名稱
mydomain = 網域名稱
myorigin = $myhostname
mydestination = /usr/local/etc/postfix/local-host-names
alias_maps =hash:/usr/local/etc/postfix/aliases
alias_database = hash:/usr/local/etc/postfix/aliases
disable_vrfy_command = yes
header_checks = regexp:/usr/local/etc/postfix/header_checks
home_mailbox = .maildir/
smtpd_recipient_restrictions = permit_mynetworks,
reject_invalid_hostname,
reject_non_fqdn_recipient,
reject_unknown_sender_domain,
reject_unauth_destination
reject_non_fqdn_sender
-----end-----
2. 在postfix目錄下增加 local-host-names, 把要讓這台mail server收信的位置加進去
3. 指令: postalias aliases
4. 指令: /usr/local/etc/rc.d/postfix start
5. 查看 /var/log/messages,看有沒有postfix的訊息
6. telnet 127.0.0.1 25, 看看會不會出現類似以下的訊息, 有的話就是ok了,寄信給自己試試看
-----begin-----
Connected to 主機名稱.
Escape character is '^]'.
220 m3.toko.edu.tw ESMTP Postfix
-----end-----
