How to Install XWiki on Ubuntu 22.04
This tutorial exists for these OS versions
- Ubuntu 22.04 (Jammy Jellyfish)
- Ubuntu 16.04 (Xenial Xerus)
On this page
XWiki is a free and open-source wiki software written in Java and runs on Tomcat. It helps users to collaborate more efficiently. It offers many useful features such as WYSIWYG editing, OpenOffice-based document import/export, semantic annotations and tagging, and advanced permissions management. It uses a database such as MySQL or PostgreSQL to store its information.
This tutorial will show you how to install XWiki software on Ubuntu 22.04 server.
Prerequisites
- A server running Ubuntu 22.04.
- A valid domain name is pointed to your server IP.
- A root password is configured on the server.
Getting Started
Before starting, update and upgrade all system packages to the latest version using the following command:
apt update -y
apt upgrade -y
Once all the packages are updated, you can install other required dependencies using the following command:
apt-get install wget curl unzip git name gnupg2 -y
Once you are finished, you can proceed to the next step.
Install Java JDK
XWiki is a Java-based application so you will need to install Java on your server. You can install it using the following command:
apt-get install default-jdk -y
Once Java is installed, you can verify the Java version using the following command:
java --version
You will get the following 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)
Add XWiki Repository
By default, the XWiki package is not included in the Ubuntu default repository. So you will need to add the XWiki official repository to your server.
First, download and add the GPG key with the following command:
wget https://maven.xwiki.org/xwiki-keyring.gpg -O /usr/share/keyrings/xwiki-keyring.gpg
Next, add the XWiki repository to APT with the following command:
wget "https://maven.xwiki.org/stable/xwiki-stable.list" -O /etc/apt/sources.list.d/xwiki-stable.list
Once the repository is added to APT, you can update the repository cache using the following command:
apt-get update -y
Next, search for XWiki package using the following command:
apt-cache search xwiki
You should see all XWiki packages in the following output:
xwiki-solr-all - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-solr-core - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-solr-data - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-solr-events - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-solr-extension_index - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-solr-like - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-solr-ratings - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-tomcat7-common - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-tomcat7-mysql - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-tomcat7-pgsql - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-tomcat8-common - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-tomcat8-mariadb - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-tomcat8-mysql - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-tomcat8-pgsql - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-tomcat9-common - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-tomcat9-mariadb - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-tomcat9-mysql - XWiki is a free wiki software platform written in Java with a design emphasis xwiki-tomcat9-pgsql - XWiki is a free wiki software platform written in Java with a design emphasis
Install XWiki on Ubuntu 22.04
Now, pick the latest version of XWiki and install it using the following command:
apt-get install xwiki-tomcat9-common xwiki-tomcat9-mariadb -y
During the installation, you will be asked to configure the database as shown below:
Select Yes and press the Enter key. You will be asked to set a MySQL password for XWiki:
Define your password and click on the OK to finish the installation.
Once the XWiki is installed, you can verify the Tomcat service using the following command:
systemctl status tomcat9.service
You will get the following output:
? tomcat9.service - Apache Tomcat 9 Web Application Server Loaded: loaded (/lib/systemd/system/tomcat9.service; enabled; vendor preset: enabled) Drop-In: /etc/systemd/system/tomcat9.service.d ??xwiki-tomcat9-systemd.conf Active: active (running) since Mon 2022-11-28 16:49:48 UTC; 6s ago Docs: https://tomcat.apache.org/tomcat-9.0-doc/index.html Process: 27582 ExecStartPre=/usr/libexec/tomcat9/tomcat-update-policy.sh (code=exited, status=0/SUCCESS) Main PID: 27586 (java) Tasks: 20 (limit: 464122) Memory: 272.6M CGroup: /system.slice/tomcat9.service ??27586 /usr/lib/jvm/default-java/bin/java -Djava.util.logging.config.file=/var/lib/tomcat9/conf/logging.properties -Djava.util.> Nov 28 16:49:49 ubuntu22041 tomcat9[27586]: Loaded Apache Tomcat Native library [1.2.31] using APR version [1.7.0]. Nov 28 16:49:49 ubuntu22041 tomcat9[27586]: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true], UDS [true]. Nov 28 16:49:49 ubuntu22041 tomcat9[27586]: APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true] Nov 28 16:49:49 ubuntu22041 tomcat9[27586]: OpenSSL successfully initialized [OpenSSL 3.0.2 15 Mar 2022] Nov 28 16:49:50 ubuntu22041 tomcat9[27586]: Initializing ProtocolHandler ["http-nio-8080"] Nov 28 16:49:50 ubuntu22041 tomcat9[27586]: Server initialization in [1204] milliseconds Nov 28 16:49:50 ubuntu22041 tomcat9[27586]: Starting service [Catalina] Nov 28 16:49:50 ubuntu22041 tomcat9[27586]: Starting Servlet engine: [Apache Tomcat/9.0.58 (Ubuntu)] Nov 28 16:49:50 ubuntu22041 tomcat9[27586]: Deploying deployment descriptor [/etc/tomcat9/Catalina/localhost/xwiki.xml]
Tomcat is not running and listens on port 8080. You can verify it with the following command:
ss -antpl | grep 8080
You should see the following output:
LISTEN 1 100 *:8080 *:* users:(("java",pid=27586,fd=39))
Configure Nginx as a Reverse Proxy
Next, you will need to configure Nginx as a reverse proxy to access the XWiki via port 80. First, install the Nginx package using the following command:
apt-get install nginx -y
After installing Nginx, create an Nginx configuration file:
nano /etc/nginx/conf.d/xwiki.conf
Add the following configuration:
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 then restart the Nginx service to apply the changes:
systemctl restart nginx
You can also verify the Nginx status using the following command:
systemctl status nginx
You will get the following output:
? nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2022-11-28 16:51:25 UTC; 5s ago Docs: man:nginx(8) Process: 27892 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Process: 27894 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Main PID: 27895 (nginx) Tasks: 3 (limit: 464122) Memory: 3.4M CGroup: /system.slice/nginx.service ??27895 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;" ??27896 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ??27897 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Nov 28 16:51:25 ubuntu22041 systemd[1]: Starting A high performance web server and a reverse proxy server... Nov 28 16:51:25 ubuntu22041 systemd[1]: Started A high performance web server and a reverse proxy server.
At this point, XWiki is installed with Nginx as a reverse proxy. You can now proceed to the next step.
Perform XWiki Web Installation
Now, open your web browser and access the XWiki web installation wizard using the URL http://xwiki.example.com/xwiki/bin/view/Main/. You should see the following screen:
Click on the Continue button. You should see the registration screen:
Define your name, admin username, password, email and click on the Register and login button. You should see the following screen:
Click on the Continue button. You should see the Flavor selection screen:
Select your XWiki flavor and click on the Install this flavor button. You should see the following screen:
Click on the Install button. You should see the following screen:
Click on the Continue button. You should see the following screen:
Click on the Continue button. You should see the XWiki dashboard on the following screen:
Conclusion
Congratulations! you have successfully installed XWiki with Nginx on Ubuntu 22.04 server. You can now deploy your own wiki application using XWiki. Feel free to ask me if you have any questions.