Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
OrganizationAdvent CalendarQiitadon (β)
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

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

More than 5 years have passed since last update.

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

インストール パッチ適用

Amazon LinuxのPostfix RPMはPostgreSQLを組み込まれてないので

  • 停止
    $ 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
    < %{?!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



  • 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

Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away


No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
Help us understand the problem. What is going on with this article?