PostgreSQL Installation

Version 9.1 by Guillaume Fenollar on 2011/12/16

Follow these instuctions:

  • Download and install PostgreSQL (
  • Download appropriate Postgres JDBC4 driver (or directly from the Maven Central Repository and copy the JAR into your container's common lib directory or in the XWiki webapp (in WEB-INF/lib)
  • Start PostgreSQL
  • Create the xwiki user and the xwiki database:
    • Using the psql tool:

      In a shell, start the PostgreSQL interactive terminal:

      psql -U <replace_with_your_admin_user_eg_postgres>;

      Create the xwiki database:

      WITH OWNER = <replace_with_your_admin_user_eg_postgres>
      TABLESPACE = pg_default;

      Verify that the xwiki database is listed in the available databases:


      Connect to the xwiki database:

      \connect xwiki

      Create a xwiki user:

      CREATE USER xwiki PASSWORD 'xwiki' VALID UNTIL 'infinity';

      Verify that the xwiki user is listed in the available users:


      Gives all permissions to the xwiki user:

      GRANT ALL ON SCHEMA public TO xwiki;
    • Using the createuser and createdb programs:

      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).

      Create the xwiki user:

      createuser xwiki -S -D -R -P -Upostgres

      Create the xwiki database:

      createdb xwiki -Eunicode -Oxwiki -Upostgres
  • 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:
    <property name="connection.url">jdbc:postgresql://localhost:5432/xwiki</property>

Get Connected