Guides 11792 Published by

This guide walks you through installing XWiki on Ubuntu 20.04, starting with a Java JDK 11 setup and a dedicated PostgreSQL database. After setting up Tomcat 9 from the default repositories, it copies a stable XWiki WAR into the webapps directory so the server auto deploys the application. Configuration files in /etc/tomcat9 tell XWiki to connect to Postgres instead of its default H2 store, and the final restart brings the wiki up at localhost:8080/xwiki where you can create an admin account. Optional steps suggest tightening security by restricting Tomcat’s user permissions and enforcing MD5 authentication on PostgreSQL, giving you a production‑ready wiki ready for further customization.



How To Install XWiki on Ubuntu 20.04

If you’re looking to get a full‑featured wiki running on your own server without buying a SaaS plan, this is the playbook. We’ll walk through installing Java, PostgreSQL, Tomcat, and the XWiki WAR file – all in the exact order that keeps your stack happy.

Minutes of Prep Work

1. Java – XWiki needs JDK 11 or newer.

2. PostgreSQL – The database engine that stores your wiki pages.

3. Tomcat – The servlet container that hosts the XWiki web app.

After that, it’s just a few commands and a bit of tweaking.

Step 1: Install Java (OpenJDK 11)
sudo apt update
sudo apt install -y openjdk-11-jdk

Why this matters?

XWiki runs on the JVM, and older JDKs (like 8) will refuse to start with a simple “Unsupported major.minor version” error. I’ve seen people hit that wall after pulling in an old XWiki release from 2015.

Verify the install:

java -version

You should see something like openjdk version "11.0.x".

Step 2: Set Up PostgreSQL
sudo apt install -y postgresql postgresql-contrib
sudo -u postgres psql

Inside the Postgres shell:

CREATE USER xwiki WITH ENCRYPTED PASSWORD 'xwikipass';
CREATE DATABASE xwiki OWNER xwiki;
\q

Why this matters?

XWiki expects a database to persist content. Using the default postgres user is risky; we create a dedicated account so that if someone exploits your XWiki, they only get the wiki data.

Step 3: Install Tomcat 9
sudo apt install -y tomcat9 tomcat9-admin

Tomcat 9 is bundled with Ubuntu 20.04 and supports JDK 11 out of the box. After installation, confirm it’s running:

systemctl status tomcat9

You should see “active (running)”.

Step 4: Grab the XWiki WAR

Pick a stable release – at the time of writing that’s 16.10.x.

cd /tmp
wget https://github.com/xwiki/xwiki-platform/releases/download/16.10.2/xwiki.war
sudo mv xwiki.war /var/lib/tomcat9/webapps/

Why this matters?

Deploying the WAR directly into Tomcat’s webapps folder triggers auto‑deployment. If you drop it in elsewhere, Tomcat won’t pick it up and you’ll see a 404.

Step 5: Configure XWiki’s Database Connection

Create a file so XWiki knows how to talk to PostgreSQL:

sudo tee /etc/tomcat9/xwiki.properties <<EOF
database.url=jdbc:postgresql://localhost:5432/xwiki
database.username=xwiki
database.password=xwikipass
EOF

Then make Tomcat read that file by adding an environment variable. Edit /etc/default/tomcat9:

sudo nano /etc/default/tomcat9

Add this line near the top (or replace the existing CATALINA_OPTS):

CATALINA_OPTS="-Ddb.url=jdbc:postgresql://localhost:5432/xwiki -Ddb.username=xwiki -Ddb.password=xwikipass"

Why this matters?

Without these properties, XWiki will spin up a default H2 database in the Tomcat folder – not what you want if you’re aiming for a production‑ready setup.

Step 6: Restart Tomcat & Finish Setup
sudo systemctl restart tomcat9

Open a browser to http://localhost:8080/xwiki. You should see the XWiki welcome page. The first time you hit it, it’ll walk you through creating an admin user and initializing the database schema.

Optional Tweaks
  • Limit Tomcat users – Create a dedicated system account for Tomcat to run as:
  sudo groupadd tomcat
  sudo usermod -aG tomcat $(whoami)

Then change the owner of /var/lib/tomcat9 to tomcat.

  • Secure PostgreSQL – Edit /etc/postgresql/12/main/pg_hba.conf to require MD5 auth and reload:
  sudo systemctl restart postgresql
You’re Done

You’ve got a fully functional XWiki instance on Ubuntu 20.04, backed by PostgreSQL and served through Tomcat. Drop in some pages, add users, or extend it with plugins—your wiki, your rules.