LoginSignup
9

More than 5 years have passed since last update.

posted at

CentOS7 で Postfix,Dovecot を使う

CentOS7.4 で Postfix と Dovecot を設定しました。CentOS が他と違うのは、ファイアウォールの設定が必要なことです。ディフォールトでは総て閉じられています。

ソフトのインストール

sudo yum -y install postfix
sudo yum -y install dovecot
sudo yum -y install cyrus-sasl

パラメータの設定はこちらを参考にしました。
メールサーバー構築(Postfix+Dovecot)

サーバーの起動

sudo systemctl start postfix
sudo systemctl enable postfix
sudo systemctl start saslauthd
sudo systemctl enable saslauthd
sudo systemctl start dovecot
sudo systemctl enable dovecot

フォイアウォールの設定
iptables でなく firewall-cmd を使いました。

sudo firewall-cmd --permanent --add-service=smtp --zone=public
sudo firewall-cmd --permanent --add-service=smtps --zone=public
sudo firewall-cmd --permanent --add-service=smtp-submission --zone=public
sudo firewall-cmd --permanent --add-service=pop3 --zone=public
sudo firewall-cmd --permanent --add-service=imap --zone=public

設定の確認

sudo firewall-cmd --list-services

注意:
 さくらインターネットのお試しでは、外部にメールを送ることができません。
 外部からのメールの受信と、内部への送信はできます。
 本契約をすると、外部にメールを送ることができるようになります。

さくらのページからの引用

お試し期間中の制限
メール送信用のポート番号となる外向きの25番ポートを閉じた設定でのご提供です。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
9