マソム自宅サーバ構築の記録

  • Dovecot1のインストール
  • 作成日:08/02/21    更新日:09/08/07

前置き

Fedora 7 のdovecot 1.0.10-17.fc7をインストールします。
MailDir形式、及びPOP3Sで受信出来るようにします。

インストール

yumでRPMパッケージをインストールします。
# yum install dovecot
      Loading "installonlyn" plugin
      Setting up Install Process
      Parsing package install arguments
      fedora                    100% |=========================| 2.1 kB    00:00
      updates                   100% |=========================| 2.3 kB    00:00
      primary.sqlite.bz2        100% |=========================| 2.3 MB    00:00
      Resolving Dependencies
      --> Running transaction check
      ---> Package dovecot.i386 0:1.0.10-17.fc7 set to be updated
      --> Processing Dependency: libmysqlclient.so.15 for package: dovecot
      --> Processing Dependency: libpq.so.5 for package: dovecot
      --> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15) for package: dovecot
      --> Restarting Dependency Resolution with new changes.
      --> Running transaction check
      ---> Package postgresql-libs.i386 0:8.2.6-1.fc7 set to be updated
      ---> Package mysql-libs.i386 0:5.0.45-6.fc7 set to be updated
      ---> Package dovecot.i386 0:1.0.10-17.fc7 set to be updated

Dependencies Resolved

        =============================================================================
        Package                 Arch       Version          Repository        Size
        =============================================================================
        Installing:
        dovecot                 i386       1.0.10-17.fc7    updates           1.7 M
        Installing for dependencies:
        mysql-libs              i386       5.0.45-6.fc7     updates           1.5 M
        postgresql-libs         i386       8.2.6-1.fc7      updates           197 k

      Transaction Summary
        =============================================================================
        Install      3 Package(s)
        Update       0 Package(s)
        Remove       0 Package(s)

      Total download size: 3.4 M
        Is this ok [y/N]: y
        Downloading Packages:
        (1/3): dovecot-1.0.10-17. 100% |=========================| 1.7 MB    00:00
        (2/3): mysql-libs-5.0.45- 100% |=========================| 1.5 MB    00:00
        (3/3): postgresql-libs-8. 100% |=========================| 197 kB    00:00
        Running Transaction Test
        Finished Transaction Test
        Transaction Test Succeeded
        Running Transaction
        Installing: mysql-libs                   ######################### [1/3]
        Installing: postgresql-libs              ######################### [2/3]
        Installing: dovecot                      ######################### [3/3]

       Installed: dovecot.i386 0:1.0.10-17.fc7
        Dependency Installed: mysql-libs.i386 0:5.0.45-6.fc7 postgresql-libs.i386 0:8.2.6-1.fc7
      Complete!

dovecot.conf の変更

設定ファイル/etc/devecot.conf を編集します。
# vi /etc/dovecot.conf
以下変更点です。
SSLサーバ証明書と秘密キーの作り方はこちらを参照して下さい。
## Dovecot configuration file
   ・・・省略・・・

# PEM encoded X.509 SSL/TLS certificate and private key. They're opened before
# dropping root privileges, so keep the key file unreadable by anyone but
# root. Included doc/mkcert.sh can be used to easily generate self-signed
# certificate, just make sure to update the domains in dovecot-openssl.cnf
#ssl_cert_file = /etc/pki/dovecot/certs/dovecot.pem
#ssl_key_file = /etc/pki/dovecot/private/dovecot.pem
ssl_cert_file = /etc/pki/tls/certs/www.mathomfactory.com.crt
ssl_key_file = /etc/pki/tls/private/www.mathomfactory.com_nopswd.key
注)作っておいたSSLサーバ証明書と秘密キーがあるのでそれを指定します。

   ・・・省略・・・

##
## Mailbox locations and namespaces
##

# Location for users' mailboxes. This is the same as the old default_mail_env
# setting. The default is empty, which means that Dovecot tries to find the
# mailboxes automatically. This won't work if the user doesn't have any mail
# yet, so you should explicitly tell Dovecot the full location.
#
# If you're using mbox, giving a path to the INBOX file (eg. /var/mail/%u)
# isn't enough. You'll also need to tell Dovecot where the other mailboxes are
# kept. This is called the "root mail directory", and it must be the first
# path given in the mail_location setting.
#
# There are a few special variables you can use, eg.:
#
#   %u - username
#   %n - user part in user@domain, same as %u if there's no domain
#   %d - domain part in user@domain, empty if there's no domain
#   %h - home directory
#
# See doc/wiki/Variables.txt for full list. Some examples:
#
#   mail_location = maildir:~/Maildir
#   mail_location = mbox:~/mail:INBOX=/var/mail/%u
#   mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
#
# <doc/wiki/MailLocation.txt>
#
#mail_location =
mail_location = maildir:~/Maildir
注)メールの保存形式をMaildirとします。置き場所は各ユーザのホームディレクトリとします。

   ・・・省略・・・
  
##
## POP3 specific settings
##

protocol pop3 {
   ・・・省略・・・

  # Workarounds for various client bugs:
  #   outlook-no-nuls:
  #     Outlook and Outlook Express hang if mails contain NUL characters.
  #     This setting replaces them with 0x80 character.
  #   oe-ns-eoh:
  #     Outlook Express and Netscape Mail breaks if end of headers-line is
  #     missing. This option simply sends it if it's missing.
  # The list is space-separated.
  #pop3_client_workarounds =
  pop3_client_workarounds = outlook-no-nuls,oe-ns-eoh
注)Outlook、Outlook Express と Netscape の問題に対処。

   ・・・省略・・・
}

##
## LDA specific settings
##
protocol lda {
  # Address to use when sending rejection mails.
  ## postmaster_address = postmaster@example.com
  postmaster_address = postmaster@mathomfactory.com

   ・・・省略・・・
}
   ・・・省略・・・

Dovecotの起動

dovecotを起動します。
# /etc/init.d/dovecot start
自動起動の設定もします。
# /sbin/chkconfig --level 35 dovecot on

Dovecotのテスト

LAN内のWindowsマシンから、メールがPOP3とPOP3Sで受信できるかテストしました。
テストしたメーラーは、Becky!とOutlook Expressです。
紆余曲折Tips