How to Install XWiki on Debian 12

XWiki is an advanced wiki software platform that is both free and open-source. It is built using Java and can be run on servlet containers such as JBoss, Tomcat, and Jetty. To store its information, XWiki utilizes database engines like MySQL, MariaDB or PostgreSQL. There are multiple ways to install XWiki, but in this tutorial, we will focus on how to install XWiki on Debian 12 using the repository provided by XWiki.

This installation method is highly recommended for production setups as it automatically installs all the necessary components for a production instance on your server.

By following this tutorial about how to install XWiki on Debian 12, you will be able to have XWiki up and running within 10 minutes or less.

Prerequisites

  • A server running Debian 12 with a minimum 2GB of RAM and 2 CPU cores. Our Linux Cloud VPS LC VPS-2 plan is great for this.
  • A domain name to access the wiki from the internet (optional).
  • SSH access with sudo privileges, or root access.

Step 1. Log in to your server

First of all, we need to log in to our Debian 12 VPS through SSH:

ssh root@IP_Address -p Port_number

Replace “root” with a user that has sudo privileges. Additionally, replace “IP_Address” and “Port_Number” with your server’s respective IP address and SSH port number. Next, let’s make sure that we’re on Debian 12. You can do that like this:

# lsb_release -a

You should get this as the output:

No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm

Then, run the following command to make sure that all installed packages on the server are updated to their latest available versions:

# apt update && apt upgrade

Step 2. Install OpenJDK

In order to proceed with XWiki installation on Debian 12, it is necessary to install Java first. As a prerequisite, execute the command below to ensure Java is installed on your system.

# apt install default-jdk -y

Java has been installed now, we can verify the version by running this command:

# java --version

The command will print you an output similar to this:

openjdk 17.0.9 2023-10-17
OpenJDK Runtime Environment (build 17.0.9+9-Debian-1deb12u1)
OpenJDK 64-Bit Server VM (build 17.0.9+9-Debian-1deb12u1, mixed mode, sharing)

Step 3. Install XWiki

There are several ways to install XWiki, but in this article, we are going to install it the easiest way. Let’s start by adding the repository.

# wget https://maven.xwiki.org/xwiki-keyring.gpg -O /usr/share/keyrings/xwiki-keyring.gpg
# wget "https://maven.xwiki.org/stable/xwiki-stable.list" -O /etc/apt/sources.list.d/xwiki-stable.list

The GPG key has been successfully imported and packages from this repository will be considered trusted. But, before installing the packages from the newly added repository you must update the package index, and invoke this command:

# apt update

Then, let’s proceed with the installation.

# apt install xwiki-xjetty-mariadb

Choose Yes, then hit ENTER:

Just hit ENTER to continue, and the installer will create a random database password for your XWiki installation.

Once completed, you can navigate to http://YOUR_SERVER_IP_ADDRESS:8080 to complete XWiki installation.

Click on the Continue button to proceed to the next steps.

Fill out the forms and then click the ‘Register and login’ button then you will be brought to this page:

Click Continue to proceed.

In this step, you are asked whether to install a flavor or not. Click on the available flavor then hit ‘Install this flavor’ button to install it.

Click install to install the flavor. You will need to wait for a few minutes until it finishes and click the Continue button.

Click Continue:

That’s it, you are brought to the XWiki main page now.

Step 4. Install and Configure Nginx

At this point, XWiki has been installed and we can access it at http://SERVER_IP:8080. To access it through a domain or subdomain, we need to create a reverse proxy. In this step, we are going to install and configure nginx as the reverse proxy.

Simply execute this command below to install Nginx

# apt install nginx

Once installed, Nginx will automatically run and we can create an Nginx server block to host our XWiki website.

# nano /etc/nginx/conf.d/xwiki.conf

Insert the following content into the file

map $request_uri $expires {
default off;
~*\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)(\?|$) 1h;
~*\.(css) 0m;
}

expires $expires;

server {
   listen 80;
   server_name xwiki.yourdomain.com;
   charset utf-8;

   root /var/www/html;

   location /.well-known {
     alias /var/www/html;
   }

   location / {
     rewrite ^ $scheme://$server_name/xwiki$request_uri? permanent;
   }

   location ^~ /xwiki {
     proxy_pass http://localhost:8080;
     proxy_cache off;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header Host $http_host;
     proxy_set_header X-Forwarded-Proto $scheme;
     expires $expires;
   }
}

Make sure to replace xwiki.yourdomain.com with your actual domain or subdomain name pointing to your server IP address. Then, save the file and exit from the editor then reload nginx.

# systemctl reload nginx

Now, you should be able to access XWiki at http://xwiki.yourdomain.com

Step 5. Install Free SSL Certificate

This is an optional step, but you should consider installing an SSL certificate for your XWiki website. Let’s execute the command below to install certbot:

# apt install certbot python3-certbot-nginx -y

Once installed, simply run this command and follow what you see on the screen:

# certbot

The prompts should look like this:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: N
Account registered.

Which names would you like to activate HTTPS for?
We recommend selecting either all domains, or all domains in a VirtualHost/server block.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: xwiki.yourdomain.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Requesting a certificate for xwiki.yourdomain.com

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/xwiki.yourdomain.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/xwiki.yourdomain.com/privkey.pem
This certificate expires on 2024-02-17.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Successfully deployed certificate for xwiki.yourdomain.com to /etc/nginx/conf.d/xwiki.conf
Congratulations! You have successfully enabled HTTPS on https://xwiki.yourdomain.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
 * Donating to EFF:                    https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Once the SSL certificate installation is finished, the installer will modify your Nginx server block in /etc/nginx/conf.d/xwiki.conf and reload Nginx to apply the file changes.

That’s it all! You have followed this article and you managed to install XWiki on your Debian 12 Cloud VPS. Your XWiki installation should be accessible at https://xwiki.yourdomain.com.

PS. If you liked this post on how to install XWiki on Debian 12, please share it with your friends on social networks using the buttons below or simply leave a reply in the comments sections. Thanks.

Leave a Comment