[root@centos ~]# yum -y install yum-utils ← yumでSRPMをダウンロードするyumdownloaderを含むyum-utilsをインストール
[root@centos ~]# vi /etc/yum.repos.d/CentOS-source.repo ← SRPM用リポジトリ設定ファイル新規作成
[source]
name=CentOS-$releasever - source
baseurl=http://mirror.centos.org/centos/$releasever/os/SRPMS/
enabled=0
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[root@centos ~]# yumdownloader --enablerepo=source --source dovecot ← DovecotのSRPMをダウンロード
[root@centos ~]# rpm -ivh dovecot-1.0-1.2.rc15.el5.src.rpm ← DovecotのSRPMを展開
※ユーザ、グループが存在しない旨の警告メッセージが表示されるが問題ない
[root@centos ~]# vi /usr/src/redhat/SPECS/dovecot.spec ← specファイル編集
%configure \
--with-vpopmail \ ← 追加
[root@centos ~]# rpmbuild -bb --clean /usr/src/redhat/SPECS/dovecot.spec ← DovecotのRPMを作成
※時間がかかる
※rpmbuildが「ビルド依存性の失敗」で異常終了した場合
[root@centos ~]# /etc/rc.d/init.d/dovecot stop ← 起動済Dovecot停止
Dovecot Imap を停止中: [ OK ]
[root@centos ~]# yum -y remove dovecot ← インストール済Dovecot削除
[root@centos ~]# rpm -ivh /usr/src/redhat/RPMS/i386/dovecot-1.0-1.2.rc15.i386.rpm ← 作成したDovecotのRPMをインストール
[root@centos ~]# /bin/mv /etc/dovecot.conf.rpmsave /etc/dovecot.conf ← 旧Dovecot設定ファイルを流用
[root@centos ~]# vi /etc/dovecot.conf ← Dovecot設定ファイル編集(CentOS5の場合)
# vpopmail authentication
passdb vpopmail { ← コメント解除
# [cache_key=] - See cache_key in PAM for explanation.
#args =
} ← コメント解除
# vpopmail
userdb vpopmail { ← コメント解除
} ← コメント解除
# Valid UID range for users, defaults to 500 and above. This is mostly
# to make sure that users can't log in as daemons or other system users.
# Note that denying root logins is hardcoded to dovecot binary and can't
# be done even if first_valid_uid is set to 0.
#first_valid_uid = 500
first_valid_uid = 89 ← 追加
#last_valid_uid = 0
vpopmail導入により不要になったシステムアカウントによる認証設定を無効化する
※無効化しないと認証に時間(2~3秒くらい)がかかり、/var/log/secureに認証エラーメッセージが記録される
# PAM authentication. Preferred nowadays by most systems.
# Note that PAM can only be used to verify if user's password is correct,
# so it can't be used as userdb. If you don't want to use a separate user
# database (passwd usually), you can use static userdb.
# REMEMBER: You'll need /etc/pam.d/dovecot file created for PAM
# authentication to actually work.
#passdb pam { ← 行頭に#を追加(コメントアウト)
# [session=yes] [setcred=yes] [cache_key=] []
#
# session=yes makes Dovecot open and immediately close PAM session. Some
# PAM plugins need this to work, such as pam_mkhomedir.
#
# setcred=yes makes Dovecot establish PAM credentials if some PAM plugins
# need that. They aren't ever deleted though, so this isn't enabled by
# default.
#
# cache_key can be used to enable authentication caching for PAM
# (auth_cache_size also needs to be set). It isn't enabled by default
# because PAM modules can do all kinds of checks besides checking password,
# such as checking IP address. Dovecot can't know about these checks
# without some help. cache_key is simply a list of variables (see
# doc/variables.txt) which must match for the cached data to be used.
# Here are some examples:
# %u - Username must match. Probably sufficient for most uses.
# %u%r - Username and remote IP address must match.
# %u%s - Username and service (ie. IMAP, POP3) must match.
#
# If service name is "*", it means the authenticating service name
# is used, eg. pop3 or imap (/etc/pam.d/pop3, /etc/pam.d/imap).
#
# Some examples:
# args = session=yes *
# args = cache_key=%u dovecot
#args = dovecot
#} ← 行頭に#を追加(コメントアウト)
# /etc/passwd or similar, using getpwnam()
# In many systems nowadays this uses Name Service Switch, which is
# configured in /etc/nsswitch.conf. WARNING: nss_ldap is known to be broken
# with Dovecot. Don't use it, or users might log in as each others!
# http://wiki.dovecot.org/AuthDatabase/Passwd
#userdb passwd { ← 行頭に#を追加(コメントアウト)
#} ← 行頭に#を追加(コメントアウト)
[root@centos ~]# vi /etc/dovecot.conf ← Dovecot設定ファイル編集(CentOS4の場合)
auth_userdb = vpopmail ← 変更
auth_passdb = vpopmail ← 変更
#first_valid_uid = 500
first_valid_uid = 89 ← 追加
#last_valid_uid = 0
[root@centos ~]# /etc/rc.d/init.d/dovecot start ← Dovecot起動
Dovecot Imap を起動中: [ OK ]
[root@centos ~]# chkconfig dovecot on ← Dovecot自動起動設定
[root@centos ~]# chkconfig --list dovecot ← Dovecot自動起動設定確認
dovecot 0:off 1:off 2:on 3:on 4:on 5:on 6:off ← ランレベル2~5のonを確認
[root@centos ~]# rm -f dovecot-1.0-1.2.rc15.el5.src.rpm ← DovecotのSRPMを削除
[root@centos ~]# rm -f /usr/src/redhat/RPMS/i386/* ← RPM作成後始末
[root@centos ~]# rm -f /usr/src/redhat/SOURCES/* ← RPM作成後始末
[root@centos ~]# rm -f /usr/src/redhat/SPECS/* ← RPM作成後始末
[root@centos ~]# vi /etc/yum.conf ← yum設定ファイル編集
exclude=dovecot ← 追加(Dovecotをyumによるアップデート対象外にする)
|
|