install postfix ver.3.5.2 from source to centos 8 - end0tknr's kipple - 新web写経開発
先日のエントリの続きです。
今回、postfixの設定や自動起動まで実施していますが、 テスト送信を行ったところ、「status=deferred」により送信完了していません。
なので、再度、改めて、続きの調査&対応を行います。そのうち...
参考書籍
postfix設定
「Postfix 実践入門」の第4章を参考に設定
$ sudo vi /usr/local/postfix/etc/postfix/main.cf
起動テストと、起動/停止
$ sudo /usr/local/postfix/sbin/postfix check postfix: warning: smtputf8_enable is true, but EAI support is not compiled in postsuper: warning: smtputf8_enable is true, but EAI support is not compiled in
上記によれば、libicu が見つからないことが原因らしい。 ( src からのinstall時に指定したつもりではいました ) 今回は /usr/local/postfix/etc/postfix/main.cf 内で smtputf8_enable=no とすることで回避。
「postfix check」後、以下で、起動/停止
$ sudo /usr/local/postfix/sbin/postfix start postfix/postfix-script: starting the Postfix mail system $ sudo /usr/local/postfix/sbin/postfix stop postfix/postfix-script: stopping the Postfix mail system
自動起動
10.6. systemd のユニットファイルの作成および変更 Red Hat Enterprise Linux 7 | Red Hat Customer Portal
[Linux] [systemctl] 各サービスの起動(service)ファイル一覧 - noknow
上記を参考に以下のようにしました。
$ sudo vi /etc/systemd/system/postfix.service [Unit] Description=Postfix Mail Transport Agent After=syslog.target network.target [Service] Type=forking ExecStart=/usr/local/postfix/sbin/postfix start ExecReload=/usr/local/postfix/sbin/postfix reload ExecStop=/usr/local/postfix/sbin/postfix stop [Install] WantedBy=multi-user.target
$ sudo systemctl enable postfix.service Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service → /etc/systemd/system/postfix.service. $ sudo systemctl start postfix.service
テスト送信
試しに自分自身に送信します
$ { echo "From: end0tknr" echo "To: end0tknr" echo "Subject: test postfix sendmail command" echo echo "test postfix sendmail command body" } | /usr/local/postfix/sbin/sendmail -i -f end0tknr end0tknr
実行すると、「status=deferred」となっている為、未送信の状態となっていることがわかります。 未送信メールは、/var/spool/postfix/ に溜まっていますが、改めて調査 & 対応します。
$ sudo tail -f /var/log/maillog : Jun 12 09:35:04 cent80 postfix/pickup[2933]: 0A531624D5BF: uid=1000 from=<end0tknr> Jun 12 09:35:04 cent80 postfix/cleanup[3178]: 0A531624D5BF: message-id=<20200612003504.0A531624D5BF@cent80.a5.jp> Jun 12 09:35:04 cent80 postfix/qmgr[2934]: 0A531624D5BF: from=<end0tknr@cent80.a5.jp>, size=347, nrcpt=1 (queue active) Jun 12 09:35:04 cent80 postfix/local[3180]: error: open database /etc/aliases.db: No such file or directory Jun 12 09:35:04 cent80 postfix/local[3180]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled Jun 12 09:35:04 cent80 postfix/local[3180]: warning: hash:/etc/aliases is unavailable. open database /etc/aliases.db: No such file or directory Jun 12 09:35:04 cent80 postfix/local[3180]: warning: hash:/etc/aliases: lookup of 'end0tknr' failed Jun 12 09:35:04 cent80 postfix/local[3180]: 0A531624D5BF: to=<end0tknr@cent80.a5.jp>, orig_to=<end0tknr>, relay=local, delay=0.05, delays=0.03/0.01/0/0.01, dsn=4.3.0, status=deferred (alias database unavailable)