lmnr-test-1 / install-postgres.sh
Din
try naming the default user postgres
5f9a9a8
Raw
History Blame Contribute Delete
553 Bytes
#!/bin/bash
apt-get update
apt-get install -y postgresql-15 systemctl
# The recommended way to init postgres on Debian is to use pg_createcluster, not initdb,
# but `apt-get install postgresql-15` creates a default cluster. So we need to
# drop the cluster first, then create a new one.
pg_dropcluster 15 main --stop
pg_createcluster -d /data/postgresql/data -l /data/postgresql/run/main.log -p 5432 15 main
systemctl start postgresql
su - postgres -c "psql -c \"ALTER USER postgres WITH PASSWORD 'postgres_passwordabc';\""
systemctl enable postgresql