インストールメモ » 2007年07月04日 水曜日

CentOSへのDovecotインストール

CentOSにDovecotをインストールした時の手順です。
Postfixのインストールは、CentOSへのPostfixインストールを参考にしてください。

  1. Dovecotをyumを利用してインストールします。
    yum install dovecot
  2. dovecot.confの設定vi /etc/dovecot.conf
    利用したいサービスのみ記述してください。

    #protocols = imap imaps
    ↓
    protocols = imap imaps pop3 pop3s
    
  3. 自動起動の設定
    /etc/init.d/dovecot start
    chkconfig dovecot on
    
  4. yumでダウンロードしたパッケージの削除
    yum clean packages
    
Filed under: CentOS — jun 1:45:07

CentOSへのPostfixインストール

CentOSにPostfixをインストールした時の手順です。
メールの不正リレー対策として、SMTP-AUTHを組み込みます。

  1. CentOSにPostfixをyumを利用してインストールします。
    yum install postfix
  2. MTAをSendmailからPostfixに変更します。
    /etc/init.d/sendmail stop
    chkconfig --del sendmail

    リストからPostfixを選択します。

    alternatives --config mta
  3. main.cfの設定vi /etc/postfix/main.cf
    # myhostname - ホスト名の定義
    myhostname = host.example.jp
    
    # mydomain - ドメイン名の定義
    mydomain = example.jp
    
    # myorigin - ローカルからメール配信するときの送信元アドレスの定義
    # user@example.jp 形式にするなら myorigin = $mydomain
    # user@host.example.jp 形式にするなら myorigin = $myhostname
    myorigin = $mydomain
    
    # inet_interfaces - メール受信するインタフェイスの設定
    # デフォルトではローカルからの配信しか受け付けない。
    # リモートからメールを受け取れるようにするなら以下の記述を入れる。
    inet_interfaces = all
    
    # mydestination - どのメールアドレスをローカル配信するかの定義。
    mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
    
    mynetworks_style = subnet
    
    # mynetworks - メールリレーを受け付けるクライアントアドレスの設定
    mynetworks = 127.0.0.0/8
    
    // メールサーバー名の隠蔽化
    smtpd_banner = $myhostname ESMTP unknown
    
    # メール格納場所の指定(Courier-IMAPの場合は必ずMaildir/を指定)
    home_mailbox = Maildir/
    
    # エリアス設定を行うファイルの指定
    alias_maps = hash:/etc/aliases
    
    // SMTP-Auth設定
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_local_domain = $mydomain
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    broken_sasl_auth_clients = yes
  4. SMTP-Auth設定(SMTP-Auth用ユーザ/パスワードにシステムのユーザ/パスワードを使用する場合)vi /usr/lib/sasl2/smtpd.conf
    pwcheck_method: saslauthd
    mech_list: plain login
  5. 自動起動の設定
    /etc/init.d/saslauthd start
    chkconfig saslauthd on
    
    /etc/init.d/postfix start
    chkconfig postfix on
  6. yumでダウンロードしたパッケージの削除
    yum clean packages
Filed under: CentOS — jun 1:40:02