Install postgres
1
2
3
| apt update
apt upgrade -y
apt install postgresql postgresql-contrib -y
|
Set password for postgres user
switch to postgres user
enter postgres shell
set password for postgres user
Postgres config file
1
2
| vim /etc/postgresql/14/main/postgresql.conf
vim /etc/postgresql/14/main/pg_hba.conf
|
after editing, restart postgres
1
| systemctl restart postgresql
|
Cancel peer authentication for postgres user
1
| vim /etc/postgresql/14/main/pg_hba.conf
|
change
1
| local all postgres peer
|
to
Create new user
1
2
| su - postgres
createuser --help
|
Create new database
1
2
| su - postgres
createdb yourdbname
|