Postfix 3.5 설치하기
cd /usr/ports/mail/postfix
make config
make all install clean
설치한 다음에 나오는 중요한 정보
===============================================================
Postfix was *not* activated in /usr/local/etc/mail/mailer.conf!
To finish installation run the following commands:
mkdir -p /usr/local/etc/mail
install -m 0644 /usr/local/share/postfix/mailer.conf.postfix /usr/local/etc/mail/mailer.conf
===============================================================
To use postfix instead of sendmail:
- clear sendmail queue and stop the sendmail daemons
Run the following commands to enable postfix during startup:
- sysrc postfix_enable="YES"
- sysrc sendmail_enable="NONE"
If postfix is *not* already activated in /usr/local/etc/mail/mailer.conf
- mv /usr/local/etc/mail/mailer.conf /usr/local/etc/mail/mailer.conf.old
- install -m 0644 /usr/local/share/postfix/mailer.conf.postfix /usr/local/etc/mail/mailer.conf
Disable sendmail(8) specific tasks,
add the following lines to /etc/periodic.conf(.local):
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).
설치한 다음에 나오는 메시지대로 다음을 실행한다.
mkdir -p /usr/local/etc/mail
install -m 0644 /usr/local/share/postfix/mailer.conf.postfix /usr/local/etc/mail/mailer.conf
sysrc postfix_enable="YES"
sysrc sendmail_enable="NONE"
/etc/periodic.conf 설정
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 설정
내가 운영하는 서버가 my.domain 이라는 이름을 가지고 있다고 가정한다. 다음 항목들을 다시 한 번 확인하고 내 상황에 맞게 설정한다.
myhostname = mail.my.domain
mydomain = my.domain
myorigin = my.domain
mydestination = $myhostname, $mydomain, localhost.$mydomain, localhost
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/
/etc/aliases (/etc/mail/aliases) 변경
userid 가 내 계정이라고 하면 root 를 이 계정으로 바꿔준다.
root: userid
이렇게 aliases 문서를 변경하였으면 'newaliases'를 실행해서 변경사항을 /etc/aliases.db 로 갱신한다.
이렇게 모든 설정을 마친 다음에 'postfix start'를 실행해서 오류가 없이 돌아가면 나만의 메일서버가 만들어진 거다.
그리고 메일이 제대로 배달되는지 확인하려면 `sendmail -bv userid` 해 보면 된다.