나는 이전엔 Q-Mail Platform을 상당히 선호하고 있었는데, Postfix로 전향을 하게 된 계기는 DSN(Delivery Status Notification) 기능의 구현을 위해서 였다. Q-Mail을 통한 구현을 여기저기 찾아 보았는데, 결국 허탕을 치고 모든 E-Mail Platform을 Postfix로 바꾸게 되었다. 일본에 있을 때도 그렇고 쭉 5년 넘게 Q-Mail을 다루었던 경험으로 인해 처음엔 Postfix가 어찌 그리 귀찮고 낯설었는지.. 시간이 지난 지금 Postfix가 이젠 Q-Mail보다 좋은 느낌이다.
1. Installation of Postfix
간단하게 Source RPM으로 설치해도 문제가 없으므로, Lastest Version은 아래에서 구하면 된다.
http://ftp.wl0.org/official/2.7/SRPMS/
rpm -ivh [PostFix SRPM]
* 참고로 필자가 사용한 Version은 postfix-2.3.3-2.1.el5_2.src.rpm, 또한 2.3.3 version을 위한 Patch가 있으므로 postfix-2.3.3-vda.patch.gz와 postfix-sleep.patch도 download 받는다.
# cp postfix-2.3.3-vda.patch.gz /usr/src/redhat/SOURCES
# cd /usr/src/redhat/SOURCES
# gunzip postfix-2.3.3-vda.patch.gz
# cp postfix-sleep.patch /usr/src/redhat/SOURCES
# cd /usr/src/redhat/SPECS/
# cp postfix.spec postfix.spec.old
후 MySQL과 Dovecot을 사용하기 위해 Parameter를 변경 해 줄 필요가 있다.
# cd /usr/local/redhat/SPECS/
# vi postfix.spec
..
%define with_mysql 0 -> 1
%define with_dovecot 0 -> 1
..
또한, Patch를 위해 아래와 같은 정보를 추가 해 준다.
(예제에서의 84, 85, 141, 142는 Line Number, Patch Number인 Patch11, 12는 실제와 다를 수 있다.)
84 Patch11: postfix-2.3.3-vda.patch
85 Patch12: postfix-sleep.patch141 %patch11 -p1 -b .vda
142 %patch12 -p1 -b .sleep
추가적으로 RPMBUILD 및 Authentication 관련 Libary가 필요 하게 되는데 System 상에 설치되어 있지 않을 수도있으므로 아래 command를 실행 해 준다.
# yum -y install pkgconfig rpm-build db4-devel zlib-devel openldap-devel cyrus-sasl-devel pcre-devel mysql-devel openssl-devel
RPMBUILD를 통해 rpm 파일을 생성 후, 설치를 한다.
# rpmbuild -ba postfix.spec
# cd /usr/src/redhat/RPMS
# rpm -Uhv /usr/src/redhat/RPMS/x86_64/[PostFix RPM] (if x86_64)
# rpm -Uhv /usr/src/redhat/RPMS/i386/[PostFix RPM] (if i386)
YUM을 통해 Postfix가 Updating 되지 않도록 아래와 같이 설정을 한다.
# vi /etc/yum.conf
..
exclude=postfix*
..
Booting시 자동 기동을 위해
# chkconfig postfix on
해주면 Postfix 설치는 일단 끝이난다.
2. Installation of Dovecot
Dovecot은 POP3 및 IMAP Server로 Postfix와 같이 구성할 수 있다. Yum을 사용할 수 있다면 설치는 간단하다.
# yum install dovecot
# chkconfig dovecot on
TLS통한 인증 접근을 구성(POP3S, IMAPS)하고 싶다면 인증 Key를 아래와 같이 생성한다.
# cd /etc/pki/tls/certs
# make [Key_Name].pem
# openssl x509 -in [Key_Name].pem -outform DER -out [Key_Name].der
Additional : 필요한 경우 아래 Library도 설치
# yum -y install cyrus-sasl-md5 cyrus_sasl_sql cyrus-sasl-plain
# yum install gnutls
3. Installation of MySQL DB
MySQL은 Account 관련 정보 / Virtual Domain 관련 정보 / Domain 관련 정보를 관리하기 위함이다.
# version : 5.0.77 (필자가 사용한 Version임)
# ./configure --prefix=/usr/local/mysql --enable-thread-safe-client --with-innodb
# make;make install
# cd /usr/local/mysql
# cp /usr/local/mysql/share/mysql/my-[select].cnf /usr/local/mysql/my.cnf
* 환경에 맞춰 my.cnf file을 선택 설정을 한다.
4. Intallation of Apache with PHP
Apache Web Server는 Web-Mail Service를 제공하거나, Postfix Admin을 사용하고 싶은 경우 설치하면 된다.
# yum install httpd
# chkconfig --level 235 httpd off
** Apache도 환경에 맞게 설정을 한다.
5. Making and checking each configuration files for Postfix and dovecot
Postfix configuration files들은 /etc/postix Directory안에 있다.
Edit /etc/postfix/master.cf Edit /etc/postfix/main.cf Dovecot configuration files : Edit /etc/dovecot.conf Edit /etc/dovecot-mysql.conf (MySQL DB의 Account 정보를 획득을 위한 파일) Postfix with MySQL configuration files : Edit /etc/postfix/mysql_virtual_alias_maps.cf Edit /etc/postfix/mysql_virtual_domains_maps.cf Edit /etc/postfix/mysql_virtual_mailbox_maps.cf
위 3 files은 Postfix의 virtual alias, domains, mailbox 정보를 관리하기 위한 파일이다.
설정과 관련 된 자세한 내용은 Implement Postfix with Dovecot, DKIM, DomainKey, MySQL. #2에서..