22 lines
995 B
Bash
22 lines
995 B
Bash
#!/bin/bash
|
|
export SHELL="/bin/bash"
|
|
|
|
#Database Setup
|
|
mkdir /run/postgresql
|
|
#mkdir -p /var/lib/postgresql/13/main
|
|
chown -R postgres:postgres /run/postgresql/
|
|
chown -R postgres:postgres /var/lib/postgresql
|
|
chown -R postgres:postgres /var/log/postgresql
|
|
chmod 0700 /var/lib/postgresql/data
|
|
#su postgres -s $SHELL -lc "mkdir /var/lib/postgresql/data;chmod 0700 /var/lib/postgresql/13/main"
|
|
su postgres -s $SHELL -lc "initdb --auth-host=trust -D /var/lib/postgresql/data"
|
|
cp -f /etc/postgresql.conf /var/lib/postgresql/data/
|
|
cp -f /etc/pg_hba.conf /var/lib/postgresql/data/
|
|
chown -R postgres:postgres /var/lib/postgresql
|
|
su postgres -s $SHELL -lc "pg_ctl start -D /var/lib/postgresql/data"
|
|
sleep 10
|
|
echo "create user root with encrypted password 'sql';"| su postgres -s $SHELL -lc psql
|
|
echo "ALTER ROLE root SUPERUSER;" | su postgres -s $SHELL -lc psql
|
|
echo "CREATE DATABASE pleroma with template = template0 OWNER = root ENCODING = 'UTF8';" | su postgres -s $SHELL -lc psql
|
|
touch /configured.txt
|