Wiki source code of PostgreSQL Installation
Version 8.1 by Vincent Massol on 2011/12/15
Show last authors
author | version | line-number | content |
---|---|---|---|
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 | * Create the ##xwiki## user and the ##xwiki## database:((( | ||
7 | * Using the ##psql## tool:((( | ||
8 | |||
9 | In a shell, start the PostgreSQL interactive terminal: | ||
10 | |||
11 | {{code language="none"}} | ||
12 | psql -U <replace_with_your_admin_user_eg_postgres>; | ||
13 | {{/code}} | ||
14 | |||
15 | Create the ##xwiki## database: | ||
16 | |||
17 | {{code language="none"}} | ||
18 | CREATE DATABASE xwiki | ||
19 | WITH OWNER = <replace_with_your_admin_user_eg_postgres> | ||
20 | ENCODING = 'UNICODE' | ||
21 | TABLESPACE = pg_default; | ||
22 | {{/code}} | ||
23 | |||
24 | Verify that the ##xwiki## database is listed in the available databases: | ||
25 | |||
26 | {{code language="none"}} | ||
27 | \l | ||
28 | {{/code}} | ||
29 | |||
30 | Connect to the ##xwiki## database: | ||
31 | |||
32 | {{code language="none"}} | ||
33 | \connect xwiki | ||
34 | {{/code}} | ||
35 | |||
36 | Create a ##xwiki## user: | ||
37 | |||
38 | {{code language="none"}} | ||
39 | CREATE USER xwiki PASSWORD 'xwiki' VALID UNTIL 'infinity'; | ||
40 | {{/code}} | ||
41 | |||
42 | Verify that the ##xwiki## user is listed in the available users: | ||
43 | |||
44 | {{code language="none"}} | ||
45 | \du | ||
46 | {{/code}} | ||
47 | |||
48 | Gives all permissions to the ##xwiki## user: | ||
49 | |||
50 | {{code language="none"}} | ||
51 | GRANT ALL ON SCHEMA public TO xwiki; | ||
52 | {{/code}} | ||
53 | ))) | ||
54 | * Using the ##createuser## and ##createdb## programs:((( | ||
55 | |||
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). | ||
57 | |||
58 | Create the ##xwiki## user: | ||
59 | |||
60 | {{code}} | ||
61 | createuser xwiki -S -D -R -P -Upostgres | ||
62 | {{/code}} | ||
63 | |||
64 | Create the ##xwiki## database: | ||
65 | |||
66 | {{code}} | ||
67 | createdb xwiki -Eunicode -Oxwiki -Upostgres | ||
68 | {{/code}} | ||
69 | ))) | ||
70 | ))) | ||
71 | * Tell XWiki to use Oracle. 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:((( | ||
72 | {{code}} | ||
73 | <property name="connection.url">jdbc:postgresql://localhost:5432/xwiki</property> | ||
74 | {{/code}} | ||
75 | ))) |