How to Install XWiki on Ubuntu 20.04

XWiki is a free and open-source Wiki Software platform written in Java. It runs on servlet containers like Tomcat and uses a database such as MySQL to store information.

XWiki comes with  useful features such as:

  • A very powerful WYSIWYG editor used for page editing
  • A robust wiki syntax
  • Content organization
  • Create your own applications
  • File Manager
  • Tasks
  • Version Control
  • Advanced search and much more

In this tutorial, we show you how to install XWiki software on Ubuntu 20.04

Step 1: Update System

Ensure that the package index is updated with the command:

$ sudo apt update

Step 2: Installing Java

XWiki is written in Java. You need to have Java  8 or above installed in your system to meet its software requirements. By default, Ubuntu 20.04 comes with OpenJDK 11.

If you don't have Java, you can install it with the following command:

$ sudo apt install default-jdk gnupg2 -y

Once Java has been installed,  verify the Java version with the command:

$ java --version

You should get the following output:

check OpenJDK version
check OpenJDK version

Step 3: Install Xwiki from Ubuntu repository 

XWiki is not found in the Ubuntu 20.04 repository. You need to add the XWiki official repository to your system.

First, we import the GPG key with command below. But first, switch to root user.

$ sudo su

Then execute it.

#  wget -q "https://maven.xwiki.org/public.gpg" -O- | apt-key add -

The output of this command is OK

Next, switch back to sudo user and add the official XWiki repository run:

$  sudo wget "https://maven.xwiki.org/stable/xwiki-stable.list" -P /etc/apt/sources.list.d/

Next, update the repository:

$ sudo apt update

To list the available packages offered by the repository search:

$ apt-cache search xwiki 

In the list populated, you can choose which packages you would like to install. In this guide, we will install Xwiki with tomcat 9 and MariaDB as a database server.

You can  now install XWiki by running the following command:

$ sudo apt  install xwiki-tomcat9-common xwiki-tomcat9-mariadb -y

During the installation process, you will be prompted to configure a database for XWiki as shown in the screen below:

Select yes and press Enter.

configure database for Xwiki
configure database for Xwiki

Next, you will be prompted to set a password for the XWiki database as shown below. Set your desired password and press Enter to finish. Be sure to confirm it again when prompted.

Provide MySQL application password for xwiki
Provide MySQL application password for xwiki

After the  installation is completed, you can verify the Tomcat service by running the command:

$ sudo systemctl status tomcat9.service

The output should be:

Confirm Tomcat engine is running
Confirm Tomcat engine is running

Tomcat is listening on port 8080. You can verify by running the following ss command:

$ ss -antpl | grep 8080

You should get the output below:

check which port tomcat is listening on
check which port tomcat is listening on

Step 4: Configure Nginx for XWiki

Next, you will need to install and configure Nginx as a reverse proxy to access the XWiki. 

First, we need to install the Nginx  web server by running the command below:

$ sudo apt-get install nginx -y

Once the web server is installed, create a new Nginx virtual host configuration file with the command below:

$ sudo vim /etc/nginx/sites-available/xwiki.conf

Next, add the lines below:

 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 configuration file . Next, activate the Nginx virtual host by running:

$ sudo ln -s /etc/nginx/sites-available/xwiki.conf /etc/nginx/sites-enabled/

Next, edit the Nginx main configuration file and increase the hash_bucket size:

$ sudo vim /etc/nginx/nginx.conf

Add the following line below the http section as shown :

server_names_hash_bucket_size 64;
Modify-nginx-configuration-file-for-Tomcat

Save and exit the file. You should then restart the Nginx service for the changes to take effect.

$ sudo systemctl restart nginx

Step 5: Accessing XWiki Web Interface

Now, open your web browser and access the XWiki web interface using the URL http://127.0.0.1:8080/xwiki. This launches the XWiki wizard as shown.

Click the 'Continue' button.

Install XWiki on Ubuntu 20.04
Start Xwiki Wizard to install Xwiki

First, we create an admin user and set a password. Provide your username, password, and email, and then click on the Register and Login button. 

Install XWiki on Ubuntu 20.04
fill in user details

You will be taken to the page below:

Xwiki Admin user created
Admin user created

Next step is to select the flavor you desire to use and click the  Install button.

Select Xwiki flavor
Select Xwiki flavor

Next, the following page will be displayed. Click the 'Continue' button.

Install XWiki on Ubuntu 20.04
continue-with-xwiki-installation

The next page will display the default folders that ship with XWiki.

Xwiki default directories
Xwiki default directories

After the flavor installation is complete, click continue to finish with the installation. 

Finally, you will see the XWiki default dashboard:

Install XWiki on Ubuntu 20.04
Xwiki-dashboard

Conclusion

In this guide, you  have learnt how to install xwiki on Ubuntu 20.04. More information on xwiki can be found on the official documentation.

Leave a Comment