pikesaku’s blog

個人的なプログラム勉強メモです。記載内容について一切の責任は持ちません。

courier-imap(5.0.8)検証環境構築

環境

AWS EC2
AMI-ID: spel-minimal-centos-7-hvm-2019.04.1.x86_64-gp2 (ami-0022ebeda476ffd59)

参考URL

Courier-IMAP

courier-imapインストール調査

②INSTALLファイルRequirements内容調査

C++ compiler - A C++ compiler is required. The server is written in C, but there are some configuration scripts that use C++ code.

gcc-c++をインストール要

make - The GNU make is recommended. Solaris's make is to be avoided. xBSD already has a gmake port, install it and use it (use gmake everywhere this document refers to make).

→インストール済み

GDBM/DB - either the GDBM or the Berkeley DB library is required.

→gdbmはインストール済み。gdbm-develもインスタールが必要(courier-authlibのconfigure実行し必要な事が判明)

The GNU IDN library (http://www.gnu.org/software/libidn/).

→libidnはインストール済み。libidn-develもインスタールが必要(courier-imapのconfigure実行し必要な事が判明)

Gamin (http://www.gnome.org/~veillard/gamin/) or FAM(http://oss.sgi.com/projects/fam/) -- either one -- is optional. If Gamin or FAM is installed, it is used for an enhanced IMAP IDLE implementation that provides real-time folder status updates to concurrent IMAP clients that have the same folder opened.

→gaminをインストール要
FAM - ArchWiki
Gamin - ArchWiki

The Courier authentication library. Before installing Courier-IMAP, download and install https://www.courier-mta.org/authlib/.

→Courier authentication libraryをインストール要

The GNU IDN) library is required.

→libidnをインストールすれば良いと判断

The Courier unicode library. Before installing Courier-IMAP, download and install https://www.courier-mta.org/unicode/.

→Courier unicode libraryをインストール要

courier-authlibインストール調査

②INSTALLファイルRequirements内容調査

A modern version of gcc ([9]http://www.gnu.org/software/gcc/)

→インストール要

The GNU linker ([10]http://www.gnu.org/software/binutils/)

→インストール済み

Libtool ([11]http://www.gnu.org/software/libtool/). Additional, libtool's libltdl library, and its development files, must be installed. On some platforms this is a separate package. On Fedora, this is the libtool-ltdl-devel package, for example.

→libtool、libtool-ltdl、libtool-ltdl-develをインストール要

GNU make ([12]http://www.gnu.org/software/make/)

→インストール済み

The "expect" command. expect is usually included with most systems. Expect can be downloaded from http://expect.nist.gov/ if it's not installed on your system. This utility is used to change system login passwords, by scripting the passwd command. If you do not have expect installed you will not be able to change system login passwords. However non-system authentication modules (LDAP, PostgreSQL, and others) will work.

→expectをインストール要

Courier Unicode Library. Before installing Courier-IMAP, download and install [13]http://www.courier-mta.org/unicode/.

→Courier unicode libraryをインストール要

courier-unicodeインストール調査

②INSTALLファイルInstallation and usage内容調査

gcc Ver4.4以上が必要と判断。

環境構築

OSセットアップ

RHEL7のセットアップを楽にする - pikesaku’s blog

$ curl -o ./epel-release-latest-7.noarch.rpm   https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ sudo rpm -ivh ./epel-release-latest-7.noarch.rpm
$ sudo yum install -y ansible git
$ git clone https://github.com/pikesaku/setup_rhel7.git
$ sudo ansible-playbook ./setup_rhel7/setup.yml
$ sudo yum install -y bzip2

必要パッケージインストール

$ sudo yum -y install gcc gcc-c++ gamin libtool libtool-ltdl libtool-ltdl-devel expect gdbm-devel libidn-devel openssl-devel

※openssl-develはcourier-imapインストールでmakeコマンド実行し判明。

courier-unicodeインストール

$ mkdir ~/src && cd ~/src
$ wget https://sourceforge.net/projects/courier/files/courier-unicode/2.1/courier-unicode-2.1.tar.bz2/download
$ tar xjfv ./download && rm -f ./download
$ cd courier-unicode-2.1
$ ./configure
$ make
$ sudo su
# make install
# echo "/usr/local/lib" > /etc/ld.so.conf.d/courier.conf
# ldconfig
# exit

※ldconfigはcourier-imapインストールでmake checkコマンド実行し判明。

courier-authlibインストール

$ cd ~/src
$ wget https://sourceforge.net/projects/courier/files/authlib/0.69.1/courier-authlib-0.69.1.tar.bz2/download
$ tar xjfv ./download && rm -f ./download
$ cd courier-authlib-0.69.1
$ ./configure
$ make
# sudo su
# make install
# make install-configure
# echo "/usr/local/lib/courier-authlib" >> /etc/ld.so.conf.d/courier.conf
# ldconfig
# exit

※ldconfigはcourier-imapインストールでmake checkコマンド実行し判明。

courier-imapインストール

$ cd ~/src
$ wget https://sourceforge.net/projects/courier/files/imap/5.0.8/courier-imap-5.0.8.tar.bz2/download
$ tar xjfv ./download && rm -f ./download
$ cd courier-imap-5.0.8
$ ./configure --with-notice=unicode
$ make
$ make check
# sudo su
# make install
# make install-configure
# exit

サービス起動

$ sudo su
# /usr/local/sbin/authdaemond start
# /usr/lib/courier-imap/libexec/imapd.rc start

おまけ(Posrfix main.cf)

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
inet_interfaces = all
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost, example.com
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/
debug_peer_level = 2
debugger_command =
	 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
	 ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.10.1/samples
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES