※バージョン2.4.6はバージョン2.2.8とのインストールディレクトリが異なるため、手順を一読してからご実行ください。
※下記Postfixアップデート手順のみではメールサーバとして機能しません。
受信メールサーバであるDovecotのインストールと設定が別途必要となります。
下記手順にてPostfixのアップデートを完了後、こちらからDovecotの導入手順をご参照ください。
入手できるパッケージカタログの更新を行います。
# pkg-get -U
アップデートの必要があるかを確認します。
# pkg-get -c | grep postfix postfix 2.2.8,REV=2006.03.13 2.4.6,REV=2008.05.28
ソフトウェア名 | 現在インストールされているバージョン | アップデート後のバージョン |
pkg-getコマンドよりアップデートを実行します。
# pkg-get -u postfix
次のパッケージは現在インストールされています: CSWpostfix postfix - Postfix Mail Transport Agent (i386) 2.2.8,REV=2006.03.13 このパッケージを削除しますか [y,n,?,q]
yを入力し(y=yes)エンター。
<CSWpostfix> のインストールに成功しました。
上記の出力が表示され、以下の様に確認コマンド結果が出ていればアップデートは完了です。
# pkg-get -c postfix software localrev remoterev postfix 2.4.6,REV=2008.03.02 SAME
Postfix2.2.4から2.4.6へのアップデートに伴いインストール場所が以下のように変更となるため
旧バージョン(2.2.4) | 新バージョン(2.4.6) |
/opt/csw/etc/postfix | /etc/opt/csw/postfix |
手動で前バージョン設定を入れなおす必要があります。
前バージョンの環境設定ファイルをアップデートしたバージョンの環境設定ファイルへ上書きする。
# mv /opt/csw/etc/postfix/* /etc/opt/csw/postfix/
旧バージョン(2.2.4)の空となったディレクトリを削除します。
# rm -r /opt/csw/etc/postfix/
新バージョン側の設定ファイル(main.cf)を変更します。
変更箇所のみ抜粋(全文は後述)
# vi /etc/opt/csw/postfix
## Body/Header Checks ## body_checks = regexp:/opt/csw/etc/postfix/maps/body_checks header_checks = regexp:/opt/csw/etc/postfix/maps/header_checks mime_header_checks = regexp:/opt/csw/etc/postfix/maps/mime_header_checks
上記を下記のように変更。
## Body/Header Checks ## body_checks = regexp:/etc/opt/csw/postfix/maps/body_checks header_checks = regexp:/etc/opt/csw/postfix/maps/header_checks mime_header_checks = regexp:/etc/opt/csw/postfix/maps/mime_header_checks
## Maps ## canonical_maps = dbm:/opt/csw/etc/postfix/canonical recipient_canonical_maps = dbm:/opt/csw/etc/postfix/recipient_canonical sender_canonical_maps = dbm:/opt/csw/etc/postfix/sender_canonical virtual_alias_maps = dbm:/opt/csw/etc/postfix/virtual alias_maps = dbm:/opt/csw/etc/postfix/aliases alias_database = dbm:/opt/csw/etc/postfix/aliases transport_maps = dbm:/opt/csw/etc/postfix/transport mydestination = $myhostname, localhost.$mydomain
上記を下記のように変更。
## Maps ## canonical_maps = dbm:/etc/opt/csw/postfix/canonical recipient_canonical_maps = dbm:/etc/opt/csw/postfix/recipient_canonical sender_canonical_maps = dbm:/etc/opt/csw/postfix/sender_canonical virtual_alias_maps = dbm:/etc/opt/csw/postfix/virtual alias_maps = dbm:/etc/opt/csw/postfix/aliases alias_database = dbm:/etc/opt/csw/postfix/aliases transport_maps = dbm:/etc/opt/csw/postfix/transport mydestination = $myhostname, localhost.$mydomain
## Add ## mail_owner = postfix debug_peer_level = 2 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin xxgdb $daemon_directory/$process_name $process_id & sleep 5 sample_directory = /opt/csw/share/doc/postfix/samples readme_directory = /opt/csw/share/doc/postfix/README_FILES inet_interfaces = localhost
## Add ##以下はファイル最下行に新たに追記する文となります。
設定ファイルの変更は以上です。
※main.cf全文(変更済)
# cat /etc/opt/csw/postfix/main.cf
## Basic ## mynetworks = (サーバIPアドレス), 127.0.0.0/8 setgid_group = postdrop ## Path ## home_mailbox = Maildir/ command_directory = /opt/csw/sbin daemon_directory = /opt/csw/libexec/postfix mailq_path = /opt/csw/bin/mailq newaliases_path = /opt/csw/bin/newaliases queue_directory = /opt/csw/var/spool/postfix sendmail_path = /opt/csw/sbin/sendmail process_id_directory = pid manpage_directory = /opt/csw/share/man html_directory = no ## Limits ## mailbox_size_limit = 1024000000 message_size_limit = 51200000 queue_minfree = 76800000 ## SASL ## smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous broken_sasl_auth_clients = yes ## TLS ## smtpd_enforce_tls = no # smtpd_tls_cert_file = /opt/csw/openssl/certs/$myhostname.pem # smtpd_tls_loglevel = 0 # smtpd_use_tls = yes ## Miscellaneous ## owner_request_special = no recipient_delimiter = + mail_name = Mail smtpd_banner = $myhostname ESMTP smtpd_delay_reject = yes soft_bounce = no strict_rfc821_envelopes = yes unknown_local_recipient_reject_code = 550 disable_vrfy_command = yes allow_min_user = yes smtpd_error_sleep_time = 5s smtpd_junk_command_limit = 100 smtpd_etrn_restrictions = reject #smtpd_timeout = 120s ## Restrictions ## smtpd_helo_required = yes smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, #reject_rbl_client sbl-xbl.spamhaus.org, #reject_rbl_client spamcop.net, #reject_rbl_client dynablock.wirehub.net, #reject_rbl_client list.dsbl.org #reject_unknown_client smtpd_helo_restrictions = permit_mynetworks, reject_invalid_hostname, #check_helo_access dbm:/etc/opt/csw/postfix/hellowok-ips, #reject_non_fqdn_hostname, #reject_unknown_hostname smtpd_sender_restrictions = permit_mynetworks, reject_unlisted_sender, reject_non_fqdn_sender #reject_unknown_sender_domain smtpd_recipient_restrictions = permit_sasl_authenticated, reject_unlisted_recipient, reject_non_fqdn_recipient, reject_unauth_destination, reject_unknown_recipient_domain, reject_invalid_hostname, check_recipient_access dbm:/etc/opt/csw/postfix/filtered_domains smtpd_data_restrictions = reject_unauth_pipelining smtpd_end_of_data_restrictions = ## Body/Header Checks ## body_checks = regexp:/etc/opt/csw/postfix/maps/body_checks header_checks = regexp:/etc/opt/csw/postfix/maps/header_checks mime_header_checks = regexp:/etc/opt/csw/postfix/maps/mime_header_checks ## Maps ## canonical_maps = dbm:/etc/opt/csw/postfix/canonical recipient_canonical_maps = dbm:/etc/opt/csw/postfix/recipient_canonical sender_canonical_maps = dbm:/etc/opt/csw/postfix/sender_canonical virtual_alias_maps = dbm:/etc/opt/csw/postfix/virtual alias_maps = dbm:/etc/opt/csw/postfix/aliases alias_database = dbm:/etc/opt/csw/postfix/aliases transport_maps = dbm:/etc/opt/csw/postfix/transport mydestination = $myhostname, localhost.$mydomain ## Add ## sample_directory = /opt/csw/share/doc/postfix/samples readme_directory = /opt/csw/share/doc/postfix/README_FILES
SMF側で新・旧バージョンの二重認識になっているため、旧バージョン(2.2.4)の方をを削除します。
※SMF(サービス管理機能)についてはこちら
確認コマンドを入力します。(上が旧バージョン・下が新バージョン)
# svcs -a | grep postfix disabled 10:42:02 svc:/network/postfix:default disabled 10:42:21 svc:/network/smtp/postfix:default
削除コマンドを入力します。(旧バージョンの削除)
# svccfg delete svc:/network/postfix:default
確認コマンドを入力します。
# svcs -a | grep postfix disabled 10:42:21 svc:/network/smtp/postfix:default
上記のようにpostfixが1件のみ表示されれば成功です。
postfixの起動を確認します。
起動/停止の際にエラーが出ていないかを確認するため、ログの確認を行います。
ターミナルエミュレータをもう1つ起動します。
サーバログを開きます。
$ tail -f /var/log/syslog
※ -f オプションでファイルの更新分もリアルタイムで表示されます。
以降はサーバログを開いたターミナルエミュレータと併行して行いください。
# svcadm disable svc:/network/smtp/postfix:default
サーバログにエラーやwarningが出力されていないことを確認します。
Feb 26 10:52:08 ホスト名.jp postfix/postfix-script[8628]: [ID 197553 mail.info] stopping the Postfix mail system Feb 26 10:52:08 ホスト名.jp postfix/master[5181]: [ID 197553 mail.info] terminating on signal 15
# svcadm enable postfix
サーバログにエラーやwarningが出力されていないことを確認します。
Feb 26 10:53:21 ホスト名.jp postfix/postfix-script[8745]: [ID 197553 mail.info] starting the Postfix mail system Feb 26 10:53:21 ホスト名.jp postfix/master[8746]: [ID 197553 mail.info] daemon started -- version 2.4.6, configuration /etc/opt/csw/postfix
起動状態がonlineとなっていることを確認します。
# svcs -a | grep postfix online 11:27:57 svc:/network/smtp/postfix:default
# svcadm restart postfix
サーバログにエラーやwarningが出力されていないことを確認します。
Feb 26 11:06:42 ZEUA0618.zone-express.jp postfix/postfix-script[10202]: [ID 197553 mail.info] stopping the Postfix mail system Feb 26 11:06:42 ZEUA0618.zone-express.jp postfix/master[8746]: [ID 197553 mail.info] terminating on signal 15 Feb 26 11:06:42 ZEUA0618.zone-express.jp postfix/postfix-script[10248]: [ID 197553 mail.info] starting the Postfix mail system Feb 26 11:06:42 ZEUA0618.zone-express.jp postfix/master[10249]: [ID 197553 mail.info] daemon started -- version 2.4.6, configuration /etc/opt/csw/postfix
再起動後も問題ないことを確認します。
# svcs -a | grep postfix online 11:29:50 svc:/network/smtp/postfix:default
以上でアップデートは完了です。