Postgresql: Difference between revisions

From Alpine Linux
(Added PostgreSQL 17 section)
m (Better generalize certain sections)
Line 8: Line 8:
{{Cmd|rc-service postgresql start}}
{{Cmd|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.
This will start the postgresql server and perform some initial configuration. It will also create a system user called postgres.


To install, configure, and use PostgreSQL 17, which is the latest release as of Alpine v3.21, please refer to the [https://wiki.alpinelinux.org/wiki/Postgresql_16 PostgreSQL 16 Alpine Wiki page]. It will also create a system user called postgres.
To install, configure, and use PostgreSQL 17, which is the latest release as of Alpine v3.21, please refer to the [https://wiki.alpinelinux.org/wiki/Postgresql_16 PostgreSQL 16 Alpine Wiki page]. It will also create a system user called postgres.
Line 18: Line 18:
{{Cmd|rc-update add postgresql}}
{{Cmd|rc-update add postgresql}}
{{Cmd|rc-service postgresql start}}
{{Cmd|rc-service postgresql start}}
This will start the postgresql server and perform some initial configuration. It will also create a system user called postgres.


To install, configure, and use PostgreSQL 16, please refer to the [https://wiki.alpinelinux.org/wiki/Postgresql_16 PostgreSQL 16 Alpine Wiki page]. It will also create a system user called postgres.
To install, configure, and use PostgreSQL 16, please refer to the [https://wiki.alpinelinux.org/wiki/Postgresql_16 PostgreSQL 16 Alpine Wiki page]. It will also create a system user called postgres.
Line 28: Line 30:
{{Cmd|rc-service postgresql start}}
{{Cmd|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.
This will start the postgresql server and perform some initial configuration. It will also create a system user called postgres.


To configure and use PostgreSQL, please refer to the [https://wiki.alpinelinux.org/wiki/Postgresql_16 PostgreSQL 16 Alpine Wiki page] as the usage is the same.
To configure and use PostgreSQL, please refer to the [https://wiki.alpinelinux.org/wiki/Postgresql_16 PostgreSQL 16 Alpine Wiki page] as the usage is the same.
Line 39: Line 41:
{{Cmd|rc-service postgresql start}}
{{Cmd|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.
This will start the postgresql server and perform some initial configuration. It will also create a system user called postgres.


To configure and use PostgreSQL, please refer to the [https://wiki.alpinelinux.org/wiki/Postgresql_16 PostgreSQL 16 Alpine Wiki page] as the usage is the same.
To configure and use PostgreSQL, please refer to the [https://wiki.alpinelinux.org/wiki/Postgresql_16 PostgreSQL 16 Alpine Wiki page] as the usage is the same.

Revision as of 13:00, 31 October 2025

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

PostgreSQL 17

To install PostgreSQL 17,

apk add postgresql17 postgresql17-contrib postgresql17-openrc

rc-update add postgresql

rc-service postgresql start

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

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

PostgreSQL 16

To install PostgreSQL 16,

apk add postgresql16 postgresql16-contrib postgresql16-openrc

rc-update add postgresql

rc-service postgresql start

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

To install, configure, and use PostgreSQL 16, 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 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 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 adjust the version you are moving from and the version you are upgrading to.

There's also this older guide.