Install and Configure XWiki on Ubuntu 22.04 – OrcaCore
This guide, brought to you by Orcacore, will walk you through the process of installing and configuring XWiki on Ubuntu 22.04. XWiki is a powerful, free, and open-source wiki software platform written in Java, renowned for its extensibility. It’s often referred to as an enterprise wiki, boasting features like WYSIWYG editing, OpenDocument-based document import/export, semantic annotations, tagging, and robust permissions management.
XWiki’s strength lies in its ability to function as an application wiki, allowing users to store structured data and execute server-side scripts directly within the wiki interface. This is achieved through wiki macros that support various scripting languages such as Velocity, Groovy, Python, Ruby, and PHP. Users can define custom data structures within wiki documents, attach instances of these structures to documents, store them in a database, and query them using either Hibernate query language or XWiki’s own query language.
Before we begin, ensure you have the following prerequisites:
- A server running Ubuntu 22.04.
- A non-root user with sudo privileges (refer to Orcacore’s guide on Initial Server Setup with Ubuntu 22.04).
- Nginx installed for setting up a reverse proxy (refer to Orcacore’s guide on Install Nginx on Ubuntu 22.04).
Let’s dive into the steps required to Install and Configure XWiki on Ubuntu 22.04.
1. Install Java For XWiki Ubuntu 22.04
XWiki requires Java to run. Start by updating your package index and upgrading existing packages:
sudo apt update -y && sudo apt upgrade -y
Next, install the default Java Development Kit (JDK) using the following command:
sudo apt install default-jdk gnupg2 -y
Verify the installation by checking the Java version:
java --version
The output should be similar to:
**Output**
openjdk 11.0.17 2022-10-18
OpenJDK Runtime Environment (build 11.0.17+8-post-Ubuntu-1ubuntu222.04)
OpenJDK 64-Bit Server VM (build 11.0.17+8-post-Ubuntu-1ubuntu222.04, mixed mode, sharing)
2. Install XWiki on Ubuntu 22.04
Now, let’s proceed with the XWiki installation.
Add XWiki GPG Key
Add the XWiki GPG public key to your system:
sudo wget https://maven.xwiki.org/xwiki-keyring.gpg -P /usr/share/keyrings/
Add XWiki Repository
Since the XWiki repository isn’t included in Ubuntu 22.04’s default repositories, add it manually:
sudo wget "https://maven.xwiki.org/stable/xwiki-stable.list" -P /etc/apt/sources.list.d/
Update your system’s package list to include the newly added repository:
sudo apt update -y
List Available XWiki Packets
You can list the available XWiki packages to explore the options.
apt-cache search xwiki
Install XWiki with Tomcat and MariaDB
This guide uses Tomcat as the servlet container and MariaDB as the database. Install the necessary packages:
sudo apt install xwiki-tomcat9-common xwiki-tomcat9-mariadb -y
During the installation, you’ll be prompted to configure the database for XWiki.

Select "yes" to continue.
Next, set a MySQL password for the XWiki database user:

Confirm the password in the following prompt:

After the installation completes, verify that Tomcat and MariaDB services are running:
sudo systemctl status tomcat9
**Output**
Loaded: loaded (/lib/systemd/system/tomcat9.service; enabled; vendor preset>
Drop-In: /etc/systemd/system/tomcat9.service.d
â¢xwiki-tomcat9-systemd.conf
Active: **active** (**running**) since Mon 2023-01-23 07:47:29 UTC; 2min 1s ago
Docs: https://tomcat.apache.org/tomcat-9.0-doc/index.html
Process: 8998 ExecStartPre=/usr/libexec/tomcat9/tomcat-update-policy.sh (cod>
Main PID: 9002 (java)
Tasks: 57 (limit: 4575)
Memory: 678.4M
CPU: 1min 22.873s
...
sudo systemctl status mariadb
**Output**
⪠mariadb.service - MariaDB 10.6.11 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset>
Active: **active** (**running**) since Mon 2023-01-23 07:45:39 UTC; 4min 36s ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 8156 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/
...
3. Configure Nginx As a Reverse Proxy For XWiki Ubuntu 22.04
Now, configure Nginx to act as a reverse proxy for your XWiki installation. This allows you to access XWiki through a standard port (80 or 443) instead of Tomcat’s default port (8080).
Create a new Nginx virtual host configuration file:
sudo vi /etc/nginx/conf.d/xwiki.conf
Add the following configuration, replacing xwiki.example.com
with your desired domain name:
server {
listen 80;
server_name xwiki.example.com;
access_log /var/log/nginx/xwiki-access.log;
error_log /var/log/nginx/xwiki-error.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_cache_bypass $http_upgrade;
proxy_pass http://127.0.0.1:8080;
}
}
Save and close the file.
Enable the virtual host by creating a symbolic link:
sudo ln -s /etc/nginx/conf.d/xwiki.conf /etc/nginx/sites-enabled/
Increase the hash_bucket_size
value in the main Nginx configuration file to prevent potential issues with server name hashing. Open the file:
sudo vi /etc/nginx/nginx.conf
Uncomment the following line in the http
section:
server_names_hash_bucket_size 64;
Save and close the file.
Restart Nginx to apply the changes:
sudo systemctl restart nginx
4. Access the XWiki Ubuntu 22.04 Via Web UI
Open your web browser and navigate to your server’s IP address or domain name, followed by /xwiki
(if you didn’t configure a root context in Tomcat):
http://<your-server-IP>/xwiki
Wait for XWiki to initialize. The XWiki distribution wizard will appear. Click "continue."

Create an administrator user for your XWiki instance. Enter the desired username, password, and email address, then click "register and log in."

Choose a "flavor" (a pre-configured set of extensions) for your XWiki installation and click "install this flavor."

Follow the on-screen instructions to complete the flavor installation.
After the flavor installation is complete, click "continue" to finish the installation process.

You will now be greeted by the XWiki welcome dashboard.

Congratulations! You have successfully installed and configured XWiki on Ubuntu 22.04. Refer to the XWiki Documentation for more information on using XWiki.
Conclusion
This tutorial covered the steps to Install and Configure XWiki on Ubuntu 22.04. With XWiki installed, you can now leverage its powerful features for collaborative knowledge management, documentation, and more. XWiki Ubuntu 22.04 offers a flexible platform for teams to build wikis, documentation, and comprehensive knowledge bases.
Alternative Solutions for Installing XWiki
While the above method utilizes Tomcat and MariaDB, here are two alternative approaches for deploying XWiki on Ubuntu 22.04:
1. Using Docker:
Docker simplifies the deployment process by encapsulating XWiki and its dependencies within a container. This eliminates the need for manual installation and configuration of Tomcat and MariaDB.
-
Explanation: Docker allows you to run XWiki in an isolated environment, ensuring consistency across different systems. A Docker Compose file can define the XWiki and MariaDB services, along with their configurations.
-
Example
docker-compose.yml
:
version: "3.8"
services:
db:
image: mariadb:10.6
restart: always
environment:
MYSQL_ROOT_PASSWORD: your_root_password
MYSQL_DATABASE: xwiki
MYSQL_USER: xwiki
MYSQL_PASSWORD: your_xwiki_password
volumes:
- db_data:/var/lib/mysql
xwiki:
image: xwiki:stable-tomcat
restart: always
ports:
- "8080:8080"
environment:
DB_TYPE: mariadb
DB_HOST: db
DB_PORT: 3306
DB_NAME: xwiki
DB_USER: xwiki
DB_PASSWORD: your_xwiki_password
depends_on:
- db
volumes:
db_data:
To deploy, save the file as docker-compose.yml
and run docker-compose up -d
in the same directory. Access XWiki at http://your-server-ip:8080
. Remember to replace the placeholder passwords with strong, unique values.
2. Using PostgreSQL as the Database:
Instead of MariaDB, you can configure XWiki to use PostgreSQL. This might be preferable if you already have a PostgreSQL server running or prefer its features.
-
Explanation: This involves installing the necessary PostgreSQL packages, creating a database and user for XWiki, and configuring XWiki to connect to the PostgreSQL server.
-
Steps:
-
Install PostgreSQL:
sudo apt install postgresql postgresql-contrib
-
Create a Database and User:
sudo -u postgres psql CREATE DATABASE xwiki; CREATE USER xwiki WITH PASSWORD 'your_xwiki_password'; GRANT ALL PRIVILEGES ON DATABASE xwiki TO xwiki; q
-
Install XWiki with Tomcat (without MariaDB):
sudo apt install xwiki-tomcat9-common
-
Configure XWiki to use PostgreSQL:
-
After installing XWiki, you’ll need to modify the
xwiki.cfg
file (usually located in/etc/xwiki/xwiki.cfg
or/opt/xwiki/webapps/xwiki/WEB-INF/xwiki.cfg
depending on the XWiki version and installation method). -
Update the database configuration to point to your PostgreSQL database:
xwiki.db.type=postgresql xwiki.db.url=jdbc:postgresql://localhost:5432/xwiki xwiki.db.user=xwiki xwiki.db.password=your_xwiki_password
-
-
Restart Tomcat:
sudo systemctl restart tomcat9
-
These alternative solutions offer different advantages and may be more suitable depending on your existing infrastructure and preferences. Remember to adapt the configurations to your specific environment.