File size: 553 Bytes
01aa009
 
 
5f9a9a8
e62990b
 
 
 
5f9a9a8
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/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