安裝postfix
本文採packages安裝
1. 安裝packages:
cd /usr/ports/mail/postfix
make install
會出來第一個對話框,如果你需要AUTH sasl 功能,請勾選SASL。
接著請選擇OK。
第二個對話框請不要勾選,可能會造成編譯錯誤(有人能跟我講為什麼嗎?)
接著去上個廁所讓他跑吧!
2. 設定/usr/local/etc/postfix/main.cf
請找出下列列表中的內容,並加以修改,如果沒有的話,請自行加上去:
變數 | 內容 |
myhostname = | 你的hostdomain |
mydomain = | 你的domain |
mydestination = | /usr/local/etc/postfix/local-host-names |
disable_vrfy_command = | yes |
relay_domains = | $mydestination |
alias_maps = | hash:/usr/local/etc/postfix/aliases |
smtpd_recipient_restrictions = | permit_mynetworks, hash:/usr/local/etc/postfix/rcptto-access,check_relay_domains, |
3. 更改主機sendmail 執行位置,更改/etc/mail/mailer.conf:
sendmail /usr/local/sbin/sendmail
send-mail /usr/local/sbin/sendmail
mailq /usr/local/sbin/sendmail
newaliases /usr/local/sbin/sendmail
4. 執行各項設定檔:
4.1 編緝 /usr/local/etc/postfix/local-host-names
將本機的domain加入這個檔,每行一個domain
4.2 轉寄名單
格式與sendmail的aliases
如:root: lman
在執行
postalias /usr/local/etc/postfix/aliases
4.3 加入可以送信的domain
touch /usr/local/etc/postfix/rcptto-access
postmap hash:/usr/local/etc/postfix/rcptto-access
5. 啟動postfix
先在/usr/local/etc/rc.d中加前一個postfix.sh
#!/bin/sh
/usr/local/sbin/postfix start
接著
chmod 500 postfix.sh
然著中止sendmail
刪除方法可用
ps -ax |grep sendmail
kill -9 PID
接著將FreeBSD內建的啟動Sendmail取消
方法有二:
1. /stand/sysinstall
Configure->Networking
將Sendmail 的X拿掉。
2. 將/etc/rc.conf
將sendmail_enable="YES"改為"NO"
最後 /usr/local/etc/rc.d/postfix.sh
第二階段 安裝SASL
加入設定
將以下加入/usr/local/etc/posfix/main.cf
smtpd_recipient_restrictions = permit_sasl_autheNticated,check_relay_domains,per
mit_mynetworks
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = boss.brain-c.com
3. 將postfix加入cyrus的群組裡
如:cyrus:*:60:daemon,postfix
4. 設定smtpd.cf
製作一個檔案 /usr/local/lib/sasl/smtpd.conf
pwcheck_method: pwcheck
重新啟動!
如此應該就可以使用了! try it!