Postgresql

From Alpine Linux

General

PostgreSQL is a well known opensource database that scales well and is easy to use.

PostgreSQL 16

To install, configure, and use PostgreSQL 16, which is the latest release, please refer to the PostgreSQL 16 Alpine Wiki page. It will also create a system user called postgres.

PostgreSQL 15

To install PostgreSQL 15,

apk add postgresql15 postgresql15-contrib postgresql15-openrc

rc-update add postgresql

rc-service postgresql start

This will start the postgresql 15 server and perform some initial configuration. It will also create a system user called postgres.

To configure and use PostgreSQL, please refer to the PostgreSQL 16 Alpine Wiki page as the usage is the same.

PostgreSQL 14

To install PostgreSQL 14,

apk add postgresql14 postgresql14-contrib postgresql14-openrc

rc-update add postgresql

rc-service postgresql start

This will start the postgresql 14 server and perform some initial configuration. It will also create a system user called postgres.

To configure and use PostgreSQL, please refer to the PostgreSQL 16 Alpine Wiki page as the usage is the same.

Switching between PostgreSQL versions

On Alpine Linux, you can use the command `pg_versions` to switch between PostgreSQL versions. This is very helpful when upgrading the version you are using.

Upgrading PostgreSQL

Please follow along with this guide and substitute the version you are moving from and the version you are upgrading to.