Wiki source code of PostgreSQL Installation

Version 9.1 by Guillaume Fenollar on 2011/12/16

Hide last authors
Vincent Massol 1.18 1 Follow these instuctions:
2
Vincent Massol 1.1 3 * Download and install PostgreSQL (http://www.postgresql.org/)
Vincent Massol 7.1 4 * Download appropriate [[Postgres JDBC4 driver>>http://jdbc.postgresql.org/download.html]] (or directly from the [[Maven Central Repository>>http://repo1.maven.org/maven2/postgresql/postgresql/]] and copy the JAR into your container's common lib directory or in the XWiki webapp (in ##WEB-INF/lib##)
Vincent Massol 1.1 5 * Start PostgreSQL
Vincent Massol 7.1 6 * Create the ##xwiki## user and the ##xwiki## database:(((
7 * Using the ##psql## tool:(((
Vincent Massol 1.1 8
Vincent Massol 7.1 9 In a shell, start the PostgreSQL interactive terminal:
10
Vincent Massol 3.1 11 {{code language="none"}}
Vincent Massol 7.1 12 psql -U <replace_with_your_admin_user_eg_postgres>;
13 {{/code}}
Vincent Massol 1.1 14
Vincent Massol 7.1 15 Create the ##xwiki## database:
Vincent Massol 8.1 16
Vincent Massol 7.1 17 {{code language="none"}}
muzi 1.10 18 CREATE DATABASE xwiki
Vincent Massol 4.1 19 WITH OWNER = <replace_with_your_admin_user_eg_postgres>
muzi 1.10 20 ENCODING = 'UNICODE'
21 TABLESPACE = pg_default;
Vincent Massol 7.1 22 {{/code}}
muzi 1.10 23
Vincent Massol 7.1 24 Verify that the ##xwiki## database is listed in the available databases:
25
26 {{code language="none"}}
Vincent Massol 5.1 27 \l
Vincent Massol 7.1 28 {{/code}}
Vincent Massol 5.1 29
Vincent Massol 7.1 30 Connect to the ##xwiki## database:
31
32 {{code language="none"}}
rssh 2.1 33 \connect xwiki
Vincent Massol 7.1 34 {{/code}}
muzi 1.16 35
Vincent Massol 7.1 36 Create a ##xwiki## user:
37
38 {{code language="none"}}
muzi 1.16 39 CREATE USER xwiki PASSWORD 'xwiki' VALID UNTIL 'infinity';
Vincent Massol 7.1 40 {{/code}}
muzi 1.16 41
Vincent Massol 7.1 42 Verify that the ##xwiki## user is listed in the available users:
43
44 {{code language="none"}}
Vincent Massol 6.1 45 \du
Vincent Massol 7.1 46 {{/code}}
Vincent Massol 6.1 47
Vincent Massol 7.1 48 Gives all permissions to the ##xwiki## user:
49
50 {{code language="none"}}
muzi 1.10 51 GRANT ALL ON SCHEMA public TO xwiki;
Vincent Massol 3.1 52 {{/code}}
Vincent Massol 7.1 53 )))
54 * Using the ##createuser## and ##createdb## programs:(((
Vincent Massol 1.1 55
Vincent Massol 7.1 56 Make sure that the ##createuser## and ##createdb## programs are in your ##$PATH##. The example below also assumes that the ##postgres## user exists in your setup (this is the default on Linux).
Vincent Massol 3.1 57
Vincent Massol 7.1 58 Create the ##xwiki## user:
59
Vincent Massol 3.1 60 {{code}}
Vincent Massol 7.1 61 createuser xwiki -S -D -R -P -Upostgres
Vincent Massol 3.1 62 {{/code}}
Vincent Massol 7.1 63
64 Create the ##xwiki## database:
65
66 {{code}}
67 createdb xwiki -Eunicode -Oxwiki -Upostgres
68 {{/code}}
Vincent Massol 4.1 69 )))
Vincent Massol 7.1 70 )))
Guillaume Fenollar 9.1 71 * Tell XWiki to use this database. To do this, edit the ##WEB-INF/hibernate.cfg.xml## file where you have expanded the XWiki WAR file and uncomment the PostgreSQL part. Make sure to review the ##connection.url## property. For example a typical value would be:(((
Vincent Massol 3.1 72 {{code}}
Vincent Massol 1.24 73 <property name="connection.url">jdbc:postgresql://localhost:5432/xwiki</property>
Vincent Massol 4.1 74 {{/code}}
75 )))

Get Connected