LoginSignup
2
2

More than 5 years have passed since last update.

Amazon LinuxでPostfix/PostgreSQLを用いたPostfixAdmin構築

Last updated at Posted at 2014-12-15

Amazon LinuxでPostfixを用いたPostfixAdmin構築ログ

インストール パッチ適用

Amazon LinuxのPostfix RPMはPostgreSQLを組み込まれてないので
src-rpmでビルドする。

  • 停止
    $ sudo /etc/init.d/postfix stop

  • 削除
    $ sudo rpm -e postfix

  • SRPM取得
    ※amazon linuxのrpm取得方法はその都度確認
    $ get_reference_source -d -p postfix

  • specファイル編集
    $ cd /usr/src/srpm/debug
    $ sudo rpm -ivh postfix-2.6.6-2.14.amzn1.src.rpm
    $ su -

    # cd /root/rpmbuild/SPECS
    # cp -p postfix.spec postfix.spec.date +%Y%m%d
    # vim postfix.spec
    # diff postfix.spec postfix.spec.date +%Y%m%d
    3,4c3,4
    < %{?!MYSQL: %define MYSQL 0}
    < %{?!PGSQL: %define PGSQL 1}
    ---
    > %{?!MYSQL: %define MYSQL 1}
    > %{?!PGSQL: %define PGSQL 0} `

# yum install rpm-build
# yum install dovecot dovecot-pgsql php httpd postgresql-server postgresql-libs postgresql-devel openldap-devel cyrus-sasl-devel pcre-devel db4-devel zlib-devel openssl-devel

  • パッチ適用

# cd ../SOURCES/
# wget http://patches.netspiders.net/postfix/postfix-2.6.6-linux3.patch
# cd ../SPECS/
# wget http://patches.netspiders.net/postfix/postfix-2.6.6-linux3.spec.patch
# patch -p0 < postfix-2.6.6-linux3.spec.patch

  • ビルド
    # rpmbuild -ba postfix.spec

  • インストール
    # cd /root/rpmbuild/RPMS/x86_64
    # rpm -ivh postfix-2.6.6-2.14.amzn1.x86_64.rpm

  • pgsqlモジュール確認
    # postconf -m

あとはmysqlの連携と変わらず。

備考

  • PostfixAdmin使用時のmain.cf例

# Postfix admin settings
local_transport = local
virtual_transport = virtual
virtual_mailbox_base = /home/mailuser
virtual_alias_maps = pgsql:/etc/postfix/pgsql_virtual_alias_maps.cf
virtual_alias_domains = $virtual_alias_maps
virtual_mailbox_domains = pgsql:/etc/postfix/pgsql_virtual_domains_maps.cf
virtual_mailbox_maps = pgsql:/etc/postfix/pgsql_virtual_mailbox_maps.cf
virtual_minimum_uid = 5000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2