summaryrefslogtreecommitdiffstats
path: root/nextcloud-postgresql.txt
blob: 15e7ad91503cbff9c8ef4b274e146a900c046c46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Configure PostgreSQL for ownCloud
=================================

To use PostgreSQL as database backend, you need to do the following:

1. Make sure that your PostgreSQL service is configured and running properly.
   If this is a fresh install, you will need to run "postgresql-setup initdb"
   as root, then "systemctl enable postgresql.service; systemctl start
   postgresql.service". For more details on initial configuration of PostgreSQL
   in Fedora, see https://fedoraproject.org/wiki/PostgreSQL

2. Log in to PostgreSQL as system user to create the database and a dedicated
   user account for ownCloud:
   # su - -c "psql" postgres
     CREATE USER username WITH PASSWORD 'password';
     CREATE DATABASE nextcloud TEMPLATE template0 ENCODING 'UNICODE';
     ALTER DATABASE nextcloud OWNER TO username;
     GRANT ALL PRIVILEGES ON DATABASE nextcloud TO username;
   Choose identifier and password accordingly.
   
3. ownCloud talks to PostgreSQL via TCP/IP, so you need to configure an
   appropriate authentication mechanism in /var/lib/pgsql/data/pg_hba.conf.
   For a simple configuration with ownCloud and PostgreSQL on the same host,
   set the METHOD for the lines that apply to localhost TCP/IP connections
   to "password". ownCloud does *not* use a socket to communicate with the
   database, so the 'local' line in pg_hba.conf does *not* apply to it.
   Note that this will result in the password being sent unencrypted from
   ownCloud to the PostgreSQL server. For more details, see
   http://www.postgresql.org/docs/9.3/static/auth-pg-hba-conf.html.
   
4. You also need to allow the web server to communicate with the database by
   TCP/IP: SELinux disallows this by default. Run:
   # setsebool -P httpd_can_network_connect_db on
   
Now you can launch the ownCloud setup screen, select PostgreSQL in the advanced
settings and fill in your credentials.

References
==========

https://fedoraproject.org/wiki/PostgreSQL
http://www.postgresql.org/docs
http://doc.nextcloud.org/server/7.0/admin_manual/configuration/configuration_database.html