test
[hcoop/zz_old/ikiwiki] / DaemonAdmin / PostgreSQL.mdwn
1 See MySQL for list of things that have to be done for any database
2 (both MySQL and Postgres).
3
4 = Postgres-specific setup =
5
6 1. $dir = /afs/hcoop.net/common/databases/USERNAME/postgres
7
8 If $dir does NOT exist:
9
10 1. sudo -u postgres psql -c "CREATE USER '''USERNAME'''" template1
11 1. mkdir -p $dir
12 1. chown postgres:postgres "$dir"
13 1. fs setacl -dir $dir -acl postgres write
14 1. fs setacl -dir $dir -acl databases none # (keep out other databases, just in case)
15 1. fs setacl -dir $dir -acl system:backup rl # (should be inherited from parent dir)
16 1. sudo -u postgres psql -c "CREATE TABLESPACE user_'''USERNAME''' OWNER '''USERNAME''' LOCATION '$dir'" template1
17
18 When it does, go directly to database creation step:
19
20 1. sudo -u postgres createdb -O '''USERNAME''' -D user_'''USERNAME''' '''DBNAME'''