Wiki source code of PostgreSQL Installation

Version 10.1 by Vincent Massol on 2012/01/12

Show last authors
1 Follow these instuctions:
2
3 * Download and install PostgreSQL (http://www.postgresql.org/)
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##)
5 * Start PostgreSQL
6 ** On Mac you could issue the following shell commands to start/stop PostgreSQL 9.1 (adapt to your version and to your setup):(((
7 {{code language="none"}}
8 sudo -u postgres /Library/PostgreSQL/9.1/bin/pg_ctl start -D /Library/PostgreSQL/9.1/data
9 sudo -u postgres /Library/PostgreSQL/9.1/bin/pg_ctl stop -D /Library/PostgreSQL/9.1/data
10 {{/code}}
11 )))
12 * Create the ##xwiki## user and the ##xwiki## database:(((
13 * Using the ##psql## tool:(((
14
15 In a shell, start the PostgreSQL interactive terminal:
16
17 {{code language="none"}}
18 psql -U <replace_with_your_admin_user_eg_postgres>;
19 {{/code}}
20
21 Create the ##xwiki## database:
22
23 {{code language="none"}}
24 CREATE DATABASE xwiki
25 WITH OWNER = <replace_with_your_admin_user_eg_postgres>
26 ENCODING = 'UNICODE'
27 TABLESPACE = pg_default;
28 {{/code}}
29
30 Verify that the ##xwiki## database is listed in the available databases:
31
32 {{code language="none"}}
33 \l
34 {{/code}}
35
36 Connect to the ##xwiki## database:
37
38 {{code language="none"}}
39 \connect xwiki
40 {{/code}}
41
42 Create a ##xwiki## user:
43
44 {{code language="none"}}
45 CREATE USER xwiki PASSWORD 'xwiki' VALID UNTIL 'infinity';
46 {{/code}}
47
48 Verify that the ##xwiki## user is listed in the available users:
49
50 {{code language="none"}}
51 \du
52 {{/code}}
53
54 Gives all permissions to the ##xwiki## user:
55
56 {{code language="none"}}
57 GRANT ALL ON SCHEMA public TO xwiki;
58 {{/code}}
59 )))
60 * Using the ##createuser## and ##createdb## programs:(((
61
62 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).
63
64 Create the ##xwiki## user:
65
66 {{code}}
67 createuser xwiki -S -D -R -P -Upostgres
68 {{/code}}
69
70 Create the ##xwiki## database:
71
72 {{code}}
73 createdb xwiki -Eunicode -Oxwiki -Upostgres
74 {{/code}}
75 )))
76 )))
77 * 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:(((
78 {{code}}
79 <property name="connection.url">jdbc:postgresql://localhost:5432/xwiki</property>
80 {{/code}}
81 )))

Get Connected