Postfixによるメールサーバ構築 (Postfix+MySQL+Dovecot+postfixadmin)
- Postfixによるメールサーバ構築 その1 (PostfixをSRPMからリビルド)
- Postfixによるメールサーバ構築 その2 (MySQLの設定とpostfixadminのインストール)
- Postfixによるメールサーバ構築 その3 (Postfixの設定)
- Postfixによるメールサーバ構築 その4 (Dovecotのインストールと設定)
PostfixをSRPMからリビルドしてMySQLに対応させる
PostfixのSRPMとVDAパッチをダウンロードします。
cd /usr/local/src/ wget http://ftp.riken.jp/Linux/centos/5.2/os/SRPMS/postfix-2.3.3-2.src.rpm mkdir -p /usr/src/redhat/SOURCES rpm -ihv postfix-2.3.3-2.src.rpm cd /usr/src/redhat/SOURCES wget http://vda.sourceforge.net/VDA/postfix-2.3.3-vda.patch.gz gunzip postfix-2.3.3-vda.patch.gz
PostfixのSRPMのspecファイルにMySQLを有効にする設定とパッチの追加設定を行います
cd /usr/src/redhat/SPECS/ cp postfix.spec postfix.spec.org vi postfix.spec 【変更】 ---------------------------------------------------- %define MYSQL 0 ---------------------------------------------------- %define MYSQL 1 ---------------------------------------------------- 【追加】 ---------------------------------------------------- Patch9: postfix-2.2.5-cyrus.patch ---------------------------------------------------- Patch9: postfix-2.2.5-cyrus.patch Patch10: postfix-2.3.3-vda.patch ---------------------------------------------------- 【追加】 ---------------------------------------------------- %patch9 -p1 -b .cyrus ---------------------------------------------------- %patch9 -p1 -b .cyrus %patch10 -p1 -b .vda ----------------------------------------------------
リビルドに必要なパッケージをインストールしてPostfixをリビルドします
yum -y install gcc rpm-build db4-devel pkgconfig zlib-devel openldap-devel cyrus-sasl-devel pcre-devel mysql-devel openssl-devel rpmbuild -ba postfix.spec i386の場合 rpm -Uhv /usr/src/redhat/RPMS/i386/postfix-2.3.3-2.i386.rpm x86_64の場合 rpm -Uhv /usr/src/redhat/RPMS/x86_64/postfix-2.3.3-2.x86_64.rpm
postfixをyumでアップデートしないようにし、デフォルトのMTA、sendmailの自動起動をoffにしてPostfixをonにします。
vi /etc/yum.conf ---------------------------------------------------- exclude=postfix* ---------------------------------------------------- /etc/init.d/sendmail stop chkconfig sendmail off chkconfig --list sendmail chkconfig postfix on chkconfig --list postfix
alternativesでpostfixを選択、この場合は2を入力してEnter
alternatives --config mta ---------------------------------------------------- There are 2 programs which provide 'mta'. Selection Command ----------------------------------------------- *+ 1 /usr/sbin/sendmail.sendmail 2 /usr/sbin/sendmail.postfix Enter to keep the current selection[+], or type selection number: 2 ----------------------------------------------------
次の記事ではMySQLの設定とメールアドレス管理ソフトpostfixadminのインストールを行います。
Postfixによるメールサーバ構築 (Postfix+MySQL+Dovecot+postfixadmin) 【最初の記事】