LoginSignup
3
3

More than 3 years have passed since last update.

Centos8にPostfixをインストールした

Posted at

◆環境

   CentOS Linux release 8.0.1905 (Core)
   サーバ(GUI)だけでインストールを実施
   ネットワーク設定は済ませた
   MySQL8.0はインストールした
   Zabbixはインストールした
    ・・・やっぱりメール送信したくなりますよね

◆やったこと

1.Postfixのインストール

 # dnf install postfix
メタデータの期限切れの最終確認: 1 day, 21:33:26 時間前の 2019年11月26日 00時43分36秒 に実施しました。
依存関係が解決しました。
==============================================================================================================================
 パッケージ                  アーキテクチャー           バージョン                           リポジトリ                 サイズ
==============================================================================================================================
Installing:
 postfix                     x86_64                     2:3.3.1-8.el8                        BaseOS                     1.5 M

トランザクションの概要
==============================================================================================================================
インストール  1 パッケージ

ダウンロードサイズの合計: 1.5 M
インストール済みのサイズ: 4.4 M
これでよろしいですか? [y/N]: y
パッケージのダウンロード中です:
postfix-3.3.1-8.el8.x86_64.rpm                                                                195 kB/s | 1.5 MB     00:07    
------------------------------------------------------------------------------------------------------------------------------
合計                                                                                          161 kB/s | 1.5 MB     00:09     
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :                                                                                                      1/1 
  scriptletの実行中: postfix-2:3.3.1-8.el8.x86_64                                                                         1/1 
  Installing       : postfix-2:3.3.1-8.el8.x86_64                                                                         1/1 
  scriptletの実行中: postfix-2:3.3.1-8.el8.x86_64                                                                         1/1 
  検証             : postfix-2:3.3.1-8.el8.x86_64                                                                         1/1 

インストール済み:
  postfix-2:3.3.1-8.el8.x86_64   

2.サービス起動設定を行う

 # systemctl start postfix
 # systemctl enable postfix
Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service → /usr/lib/systemd/system/postfix.service.

3.メールサーバの設定変更

 # vi /etc/postfix/main.cf

4.設定ファイルを修正する
変更したのは以下の点。送信専用ならこれだけでもいい気がします・・・

・myhostname:送信に使うメールアドレス
・mydomail:送信に使うドメイン名

5.telnetが無かったのでインストールする
テストメールはtelnetを使って送ろうと思います

 # dnf -y install telnet

https://www.rem-system.com/mail-postfix01/
・・・の通りメールをGmailに送ってみたけどダメっぽい。

https://qiita.com/Esfahan/items/6fa613069b13eb7daa17
このあたりの対策が必要だそうです。

6.Gmailに送れるように対策を実施する

 # dnf install cyrus-sasl-plain cyrus-sasl-md5

 # vi /etc/postfix/sasl_password

 # postmap hash:/etc/postfix/sasl_password

もう一回送ったらいけました。

参考サイト
https://mizuti69.github.io/book_configure_centos8/8.smtp/1.smtp_config.html
http://park1.wakwak.com/~ima/centos4_switchmta2.html
https://www.rem-system.com/mail-postfix01/
https://qiita.com/Esfahan/items/6fa613069b13eb7daa17

3
3
0

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
  3. You can use dark theme
What you can do with signing up
3
3