Home > Guides > Alpine Server > Setting up PostgreSQL

Setting up PostgreSQL

Installation

Install PostgreSQL:

apk add postgresql postgresql-client

Configuration

Start the service:

/etc/init.d/postgresql setup
/etc/init.d/postgresql start
rc-update add postgresql

Create the PostgreSQL users and database for the Postfix database:

createuser -U postgres --pwprompt postfixadmin
createuser -U postgres --pwprompt postfix
createdb -U postgres --owner=postfixadmin postfix

Grant the postfix user access to the database:

psql -U postfixadmin postfix
GRANT SELECT ON alias TO postfix;
GRANT SELECT ON domain TO postfix;
GRANT SELECT ON mailbox TO postfix;
GRANT SELECT on alias_domain TO postfix;
\q