setup/doc/postgres.md

33 lines
1.0 KiB
Markdown
Raw Permalink Normal View History

2022-04-14 10:21:05 +02:00
# Setup Postgres
2022-06-05 08:35:59 +02:00
* install Postgres like [this](./postgres-install.md)
2022-04-14 10:21:05 +02:00
2022-05-25 13:25:51 +02:00
* create copy of config file ```pg_hba.conf file```\
NOTE: Insert the postgresql version <psql version> that is running on the respective host
2022-04-14 10:21:05 +02:00
```
2022-05-25 13:25:51 +02:00
cd /etc/postgresql/<psql version>/main/
2024-02-21 14:00:20 +01:00
sudo cp pg_hba.conf pg_hba.conf-bckp
2022-04-14 10:21:05 +02:00
```
2022-05-25 13:25:51 +02:00
* switch authentication method from ```peer``` to ```md5``` for all local users connecting by Unix domain sockets by opening the following config file and adding the example configuration
2022-04-14 10:21:05 +02:00
```
2022-05-25 13:25:51 +02:00
sudo vi pg_hba.conf
2022-04-14 10:21:05 +02:00
```
```
# "local" is for Unix domain socket connections only
2022-05-25 13:25:51 +02:00
#local all all peer
local all all md5
2022-04-14 10:21:05 +02:00
```
* restart PostgreSQL to enable the changes
```
2022-05-25 13:25:51 +02:00
systemctl status postgresql
2022-04-14 10:21:05 +02:00
sudo systemctl restart postgresql
systemctl status postgresql
```
2024-02-21 14:00:20 +01:00
* OPTION: allow remote connections like [this](./postgres-connect-remote.md)
2022-05-25 13:25:51 +02:00
2024-02-21 14:00:20 +01:00
* OPTION: disable start up at system boot like [this](./postgres-boot-startup-disable.md)