はじめての自宅サーバ構築 - Fedora/CentOS - Last Update 2008/07/25
It opened to 2004/09/19.
当サイトはFedora9で運用しています
Visitors
Pageviews
Today(IP/PV)
3,374,114
12,762,040
1,272/8,662
動作確認 [ FC1 / FC2 / FC3 / FC4 / FC5 / FC6 / Fedora7 / Fedora8 / Fedora9 / CentOS4 / CentOS5 ]
  1. dovecotとは・・・
  2. dovecotのインストール
  3. dovecotの設定
  4. dovecotの起動
  5. OSの再起動を行なった時にdovecot(POPサーバ)を自動的に起動するように設定する
  6. 接続前の準備
  7. クライアントメールソフトの設定
    設定例(Becky!)
  8. こんな時は・・・

■ dovecotとは・・・

dovecotとは、POPサーバ(受信メールサーバ)機能を提供するパッケージです。
また、POPサーバとは逆に送信メールサーバを構築するには、『メールサーバ(SMTP)の構築(Postfix)』をご覧ください。

■ dovecotのインストール

# yum -y install dovecot

■ dovecotの設定

設定ファイルの編集
# vi /etc/dovecot.conf
プロトコルを指定
# Protocols we want to be serving:
protocols = imap imaps pop3 pop3s

メールボックス(Maildir)を各ユーザのホームディレクトリに配置
*******************************************************************************************************
* dovecot Ver 1.0以上( 1.0 <= Ver )は、属性名「default_mail_env」が「mail_location」に変更されました。*
* バージョンは以下のコマンドで確認できます                                                            *
* # rpm -qa dovecot                                                                                   *
* dovecot-1.0-1.rc15.fc6                                                                              *
*******************************************************************************************************

【dovecot Ver 1.0未満( Ver < 1.0 )の場合】
# Default MAIL environment to use when it's not set. By leaving this empty
# dovecot tries to do some automatic detection as described in
# doc/mail-storages.txt. There's a few special variables you can use:
#
#   %u - username
#   %n - user part in user@domain, same as %u if there's no domain
#   %d - domain part in user@domain, empty if user there's no domain
#   %h - home directory
#
# You can also limit a width of string by giving the number of max. characters
# after the '%' character. For example %1u gives the first character of
# username. Some examples:
#
#   maildir:/var/mail/%1u/%u/Maildir
#   mbox:~/mail/:INBOX=/var/mail/%u
#   mbox:/var/mail/%d/%n/:INDEX=/var/indexes/%d/%n
#
default_mail_env = maildir:~/Maildir

【dovecot Ver 1.0以上( 1.0 <= Ver )の場合】
# 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
# and where Dovecot can place its index files. 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/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
#
# http://wiki.dovecot.org/MailLocation
#
mail_location = maildir:~/Maildir

chrootユーザのディレクトリ
# ':' separated list of directories under which chrooting is allowed for mail
# processes (ie. /var/mail will allow chrooting to /var/mail/foo/bar too).
# This setting doesn't affect login_chroot or auth_chroot variables.
# WARNING: Never add directories here which local users can modify, that
# may lead to root exploit. Usually this should be done only if you don't
# allow shell access for users. See doc/configuration.txt for more information.
valid_chroot_dirs = /home


Dovecot Ver 1.0からは POP3 UIDL format が変わったらしい。
メールログ「/var/log/maillog」に以下が出力され、メーラより取得する事が出来ない。
Jun  8 21:31:38 fedora dovecot: POP3(linux): pop3_uidl_format setting is missing from config file
Jun  8 21:31:38 fedora dovecot: child 2741 (pop3) returned error 89

以下のコマンドを実施して バージョンが 1.0以上( 1.0 <= Ver )であれば、以下の変更が必要
# rpm -qa dovecot
dovecot-1.0-0.beta8.1.fc5

# vi /etc/dovecot.conf
  # POP3 UIDL format to use. You can use following variables:
  #
  #  %v - Mailbox UIDVALIDITY
  #  %u - Mail UID
  #  %m - MD5 sum of the mailbox headers in hex (mbox only)
  #  %f - filename (maildir only)
  #
  # If you want UIDL compatibility with other POP3 servers, use:
  #  UW's ipop3d         : %08Xv%08Xu
  #  Courier version 0   : %f
  #  Courier version 1   : %u
  #  Courier version 2   : %v-%u
  #  Cyrus (<= 2.1.3)    : %u
  #  Cyrus (>= 2.1.4)    : %v.%u
  #  Older Dovecots      : %v.%u
  #
  # Note that Outlook 2003 seems to have problems with %v.%u format which was
  # Dovecot's default, so if you're building a new server it would be a good
  # idea to change this. %08Xu%08Xv should be pretty fail-safe.
  #
  # NOTE: Nowadays this is required to be set explicitly, since the old
  # default was bad but it couldn't be changed without breaking existing
  # installations. %08Xu%08Xv will be the new default, so use it for new
  # installations.
  #
  #pop3_uidl_format = %08Xu%08Xv
pop3_uidl_format = %u

■ dovecotの起動

dovecotを起動する
# /etc/rc.d/init.d/dovecot start
Dovecot Imap を起動中:                                     [  OK  ]

■ OSの再起動を行なった時にdovecot(POPサーバ)を自動的に起動するように設定する

起動時にdovecotを起動する
# chkconfig dovecot on
設定内容を確認
# chkconfig --list dovecot
dovecot         0:オフ  1:オフ  2:オン  3:オン  4:オン  5:オン  6:オフ

■ 接続前の準備

WANから接続するに当たって、ルータの設定が必要です。
ルータのポート開閉は、ご自分のルータ取扱説明書をご覧ください。
DNS名で接続するには事前にドメイン名の取得を行っている必要があります。(以下は代表的なものであり、また、当サイトが使用させて頂いております)

■ クライアントメールソフトの設定

当サイトで紹介している『メールサーバ(SMTP)の構築(Postfix)』は、SMTP-Auth(送信認証)を使用する様に設定しています。
よく間違えられるのは、『メールサーバ(SMTP)の構築(Postfix)[SMTP-Authユーザパスワードの設定]』で行ったそのユーザのパスワードを指定した為に認証エラーとなり取得できません。

こちらのパスワードはUNIX(Linux)アカウントのパスワードを指定します。※:SMTP-Authユーザパスワードではありません。

■ 設定例(Becky!)

当方で使用させて頂いている「Becky!」を例にあげて説明します。
メールボックスの設定で「基本設定」タブを開き、サーバー情報グループ内の以下の項目を指定します。

■ こんな時は・・・

■ 広告

ページ先頭へ

Copyright(©)2004-2008 First home server construction. All Right Reserved.