2010年(11)
分类: BSD
2010-08-19 14:29:34
最近公司要安装专门发邮件的服务器,只发不收,那真是简单到了爆
首先安装,这里最快的办法就是pkg_add -r
[root@free /]# pkg_add postfix
pkg_add: can't stat package file 'postfix'
[root@free /]# pkg_add -r postfix
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.0-release/Latest/postfix.tbz...
Done.
Added group "postfix".
Added group "maildrop".
Added user "postfix".
You need user "postfix" added to group "mail".
Would you like me to add it [y]? Done.
Would you like to activate Postfix in /etc/mail/mailer.conf [n]? n
pkg_add: warning: package 'postfix-2.6.5,1' requires 'pcre-7.9', but 'pcre-8.02' is installed
To enable postfix startup script please add postfix_enable="YES" in
your rc.conf
If you not need sendmail anymore, please add in your 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:
daily_clean_hoststat_enable="NO"
daily_status_mail_rejects_enable="NO"
daily_status_include_submit_mailq="NO"
daily_submit_queuerun="NO"
If you are using SASL, you need to make sure that postfix has access to read
the sasldb file. This is accomplished by adding postfix to group mail and
making the /usr/local/etc/sasldb* file(s) readable by group mail (this should
be the default for new installs).
If you are upgrading from postfix version prior to 2.0, please see the README
files for recommended changes to your configuration.
启动,因为没有在/etc/rc.conf 定义postfix自动启动与否,所以这里手动启动加one
[root@free /etc]# /usr/local/etc/rc.d/postfix onestart
postfix/postfix-script: starting the Postfix mail system
但是当你发送邮件的时候,100%会报一个错。检查/var/log/maillog可以看到
问题:
Aug 18 16:30:17 free postfix/smtpd[80648]: fatal: open database /etc/aliases.db: No such file or directory
Aug 18 16:30:18 free postfix/master[80373]: warning: process /usr/local/libexec/postfix/smtpd pid 80648 exit status 1
Aug 18 16:30:18 free postfix/master[80373]: warning: /usr/local/libexec/postfix/smtpd: bad command startup – throttling
解决:
1 关闭/usr/local/etc/rc.d/postfix stop
2执行newaliases
/etc/mail/aliases: 27 aliases, longest 10 bytes, 275 bytes total
记住这个路径/etc/mail/aliases
3修改/usr/local/etc/postfix/main.cf
查找到alias_map,去掉前面的# ,修改为以上的那个路径
alias_maps = hash:/etc/mail/aliases
4 重新启动postfix
测试安装是否正确
能收到邮件代表postfix可以发信了!