PostgreSQL Installation

Version 5.1 by Vincent Massol on 2011/12/15

Follow these instuctions:

  • Download and install PostgreSQL (http://www.postgresql.org/)
  • Download appropriate Postgres JDBC 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 (pick any password you want), and the xwiki database:
    # psql -U <replace_with_your_admin_user_eg_postgres>;

    // 1. create a database
    CREATE DATABASE xwiki
    WITH OWNER = <replace_with_your_admin_user_eg_postgres>
    ENCODING = 'UNICODE'
    TABLESPACE = pg_default;

    // Verify available databases
    \l

    // connect to xwiki
    \connect xwiki

    // 2. create a user xwiki
    CREATE USER xwiki PASSWORD 'xwiki' VALID UNTIL 'infinity';

    // 3. grant access to the database for the group xwiki
    GRANT ALL ON SCHEMA public TO xwiki;

    Another way, if you have 'createuser' and 'createdb' programs in your $PATH and postgres is admin user for PostgreSQL (this is by default in PostgreSQL installation on Linux):

    # createuser xwiki -S -D -R -P -Upostgres
    ## enter password, ie: 'xwiki'
    # createdb xwiki -Eunicode -Oxwiki -Upostgres
  • 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:
    <property name="connection.url">jdbc:postgresql://localhost:5432/xwiki</property>
Tags:
   

Get Connected