>> HOME >> CentOS 4 MENU >> POP/IMAPサーバー (Dovecot)
メールサーバーは、送信(SMTP)メールサーバーと受信(POP/IMAP)メールサーバーで構成されます。
ここでは、送信メールサーバーには Postfix、受信メールサーバーには Dovecot を採用します。
なお、Postfix は、迷惑メールの不正中継防止に対応させるため、SMTP-AUTH 機能(送信認証機能)をもたせます。
また、送信(SMTP)メールサーバーの導入は、『SMTP サーバー (Postfix)』を参照してください。
メールアカウントの作成とクライアントの設定は、『メールアカウントの作成 & クライアントの設定』を参照してください。

1. Dovecot インストール
2. Dovecot 設定
1 ) Dovecot 設定ファイル /etc/dovecot.conf 編集
3. Dovecot の起動と自動起動設定
1 ) Dovecot の起動
2 ) Dovecot の自動起動設定
4. 公開前の準備
1. Dovecot インストール
[root@linux ~]# yum -y install dovecot 
Repository dag is listed more than once in the configuration
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for dovecot to pack into transaction set.
dovecot-0.99.11-2.EL4.1.i 100% |=========================|  13 kB    00:00
---> Package dovecot.i386 0:0.99.11-2.EL4.1 set to be updated
--> Running transaction check
--> Processing Dependency: libpq.so.3 for package: dovecot
--> Processing Dependency: libmysqlclient.so.14 for package: dovecot
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for mysql to pack into transaction set.
mysql-4.1.20-1.RHEL4.1.i3 100% |=========================|  35 kB    00:00
---> Package mysql.i386 0:4.1.20-1.RHEL4.1 set to be updated
---> Downloading header for postgresql-libs to pack into transaction set.
postgresql-libs-7.4.13-2. 100% |=========================|  11 kB    00:00
---> Package postgresql-libs.i386 0:7.4.13-2.RHEL4.1 set to be updated
--> Running transaction check
--> Processing Dependency: perl(DBI) for package: mysql
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for perl-DBI to pack into transaction set.
perl-DBI-1.40-8.i386.rpm  100% |=========================|  11 kB    00:00
---> Package perl-DBI.i386 0:1.40-8 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 dovecot                 i386       0.99.11-2.EL4.1  base              601 k
Installing for dependencies:
 mysql                   i386       4.1.20-1.RHEL4.1  update            2.9 M
 perl-DBI                i386       1.40-8           base              466 k
 postgresql-libs         i386       7.4.13-2.RHEL4.1  update            146 k

Transaction Summary
=============================================================================
Install      4 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 4.1 M
Downloading Packages:
(1/4): dovecot-0.99.11-2. 100% |=========================| 601 kB    00:01
(2/4): mysql-4.1.20-1.RHE 100% |=========================| 2.9 MB    00:09
(3/4): postgresql-libs-7. 100% |=========================| 146 kB    00:00
(4/4): perl-DBI-1.40-8.i3 100% |=========================| 466 kB    00:01
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: perl-DBI                     ######################### [1/4]
  Installing: mysql                        ######################### [2/4]
  Installing: postgresql-libs              ######################### [3/4]
  Installing: dovecot                      ######################### [4/4]

Installed: dovecot.i386 0:0.99.11-2.EL4.1
Dependency Installed: mysql.i386 0:4.1.20-1.RHEL4.1 perl-DBI.i386 0:1.40-8 postgresql-libs.i386
0:7.4.13-2.RHEL4.1
Complete!
2. Dovecot 設定
1 ) Dovecot 設定ファイル /etc/dovecot.conf 編集
[root@linux ~]# vi /etc/dovecot.conf 

## Dovecot 1.0 configuration file

# Default values are shown after each value, it's not required to uncomment
# any of the lines. Exception to this are paths, they're just examples
# with real defaults being based on configure options. The paths listed here
# are for configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
# --with-ssldir=/usr/share/ssl

# Base directory where to store runtime data.
#base_dir = /var/run/dovecot/

# Protocols we want to be serving:
#  imap imaps pop3 pop3s
#protocols = imap imaps
# プロトコルを指定
protocols = imap imaps pop3 pop3s
  :
  :

# 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:
#
#   default_mail_env = maildir:/var/mail/%1u/%u/Maildir
#   default_mail_env = mbox:~/mail/:INBOX=/var/mail/%u
#   default_mail_env = mbox:/var/mail/%d/%n/:INDEX=/var/indexes/%d/%n
#
# メールボックス(Maildir)を各ユーザのホームディレクトリに配置
default_mail_env = maildir:~/Maildir
  :
  :


# 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
#  tpop3d              : %Mf
#
# 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.
#
# コメントを解除 ( バージョン 1.0.12-1.el5.rf 以上の場合 )
pop3_uidl_format = %08Xu%08Xv
  :
  :
3. Dovecot の起動と自動起動設定
1 ) Dovecot の起動
[root@linux ~]# service dovecot start 
dovecot を起動中:                                          [  OK  ]
2 ) Dovecot の自動起動設定
[root@linux ~]# chkconfig dovecot on 
[root@linux ~]# chkconfig --list dovecot 
dovecot         0:off   1:off   2:on    3:on    4:on    5:on    6:off
4. 公開前の準備
外部から接続するには、ルータの設定で ポート番号110番(POP3 Post Office Protocol - Version 3) を開けてください。また、外部よりDNS名でアクセスするには、ドメイン名の取得を行っている必要があります。