#!/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