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