2012年11月25日日曜日

コミュニティ版PostgreSQL9.2 + postfix2.9.4

前回インストールしたコミュニティ版のPostgreSQLをpostfixから利用できるようにする。
(また、デフォルトで組みまれるMySQLは使わないので、組み込まれないようにする)
今回も環境はCentOS6.3で、SRPMはFedoraのメンテナさんのサイトより入手したものを利用した。

以下、その手順。


SPECファイルの編集



[root@cent6 ~]# wget http://mstevens.fedorapeople.org/el6/postfix/2.9.4/x86_64/postfix-2.9.4-1.el6.src.rpm
[root@cent6 ~]# rpm -ivh postfix-2.9.4-1.el6.src.rpm
[root@cent6 ~]# cd rpmbuild/SPECS/
[root@cent6 SPECS]# cp -p postfix.spec{,.orig}
[root@cent6 SPECS]# vi postfix.spec

※編集後のdiff出力

[root@cent6 SPECS]# diff -u postfix.spec.orig postfix.spec
--- postfix.spec.orig   2012-08-02 22:30:10.000000000 +0900
+++ postfix.spec        2012-11-25 16:41:59.135013035 +0900
@@ -83,7 +83,7 @@
 %{?with_sasl:BuildRequires: cyrus-sasl-devel}
 %{?with_pcre:BuildRequires: pcre-devel}
 %{?with_mysql:BuildRequires: mysql-devel}
-%{?with_pgsql:BuildRequires: postgresql-devel}
+%{?with_pgsql:BuildRequires: postgresql92-devel}
 %{?with_tls:BuildRequires: openssl-devel}

 %description
@@ -153,8 +153,8 @@
   AUXLIBS="${AUXLIBS} -L%{_libdir}/mysql -lmysqlclient -lm"
 %endif
 %if %{with pgsql}
-  CCARGS="${CCARGS} -DHAS_PGSQL -I%{_includedir}/pgsql"
-  AUXLIBS="${AUXLIBS} -lpq"
+  CCARGS="${CCARGS} -DHAS_PGSQL -I/usr/pgsql-9.2/include"
+  AUXLIBS="${AUXLIBS} -L/usr/pgsql-9.2/lib -lpq"
 %endif
 %if %{with sasl}
   CCARGS="${CCARGS} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I%{_includedir}/sasl"
[root@cent6 SPECS]#



ビルドとインストール


[root@cent6 SPECS]# rpmbuild -bb --define="dist .el6" --with pgsql --without mysql postfix.spec

(snip)

Wrote: /root/rpmbuild/RPMS/x86_64/postfix-2.9.4-1.el6.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/postfix-perl-scripts-2.9.4-1.el6.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.QQTcLP
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd postfix-2.9.4
+ rm -rf /root/rpmbuild/BUILDROOT/postfix-2.9.4-1.el6.x86_64
+ exit 0
[root@cent6 SPECS]#
[root@cent6 SPECS]# cd ../RPMS/x86_64/
[root@cent6 x86_64]# rpm -Fvh postfix-2.9.4-1.el6.x86_64.rpm postfix-perl-scripts-2.9.4-1.el6.x86_64.rpm
Preparing...                ########################################### [100%]
   1:postfix                ########################################### [ 50%]
   2:postfix-perl-scripts   ########################################### [100%]
[root@cent6 x86_64]#



確認作業


[root@cent6 x86_64]# postconf -m
btree
cidr
environ
fail
hash
internal
ldap
memcache
nis
pcre
pgsql  ←★この行が表示されればOK
proxy
regexp
static
tcp
texthash
unix
[root@cent6 x86_64]#
[root@cent6 x86_64]# ldd /usr/sbin/postfix | grep pg
        libpq.so.5 => /usr/pgsql-9.2/lib/libpq.so.5 (0x00007fa9a5f51000)
[root@cent6 x86_64]#

0 件のコメント:

コメントを投稿