Install XWIKI

Hey everyone😀, today I want to share another interesting tool called XWiki. An amazing tool for enterprise level. For those who don't know about this tool, I recommended clicking this Wikipedia URL. So Let's see how to configure XWiki.

Step 1 Install JDK

  1. Check JAVA:-  java -version
  2. Update the repositories:-sudo apt-get update
  3. Install OpenJDK:- sudo apt-get install openjdk-8-jdk
  4. Verify the version of the JDK:- java -version
Step 2 Set up the XWiki LTS APT repo
Log in as a sudo user, and then download and set up the XWiki LTS (Long Term Support) APT repo on your server instance (source:- internet):

cd

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

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

sudo apt update

Note: If you want to try out the latest stable XWiki release (but NOT LTS), you can download the below XWiki APT repo instead (source:- internet):

cd

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

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

sudo apt update


Step 3 Install the all in one XWiki bundle
As a flexible wiki platform, XWiki officially provides various integration options. All we need a server (tomcat) and a database(MySQL)


apt search xwiki


If you want to use XWiki with the most common dependencies, you can install all required components in one command as follows:
sudo apt install xwiki-tomcat9-mysql -y



During the installation process, you will be asked to set up a new password for the MySQL root user several times. Just leave the password field blank and press Enter to skip this step for now. We will tackle this problem later while securing the installation of MySQL.

When being asked whether you want to Configure database for XWiki with dbconfig-common?, choose <Yes> and then press ENTER.

When being asked to provide a MySQL application password for XWiki, you can either input a specific MySQL application password or leave the password field blank. The latter will tell XWiki to use a random MySQL application password.



Having XWiki and all of the required dependencies installed, secure the installation of MySQL:

sudo /usr/bin/mysql_secure_installation

During the process, the program will ask you a few questions. Reply to them as below:-

  • Would you like to setup VALIDATE PASSWORD plugin?  Y
  • Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
  • New password: a-strong-MySQL-root-password
  • Re-enter new password: a-strong-MySQL-root-password
  • Do you wish to continue with the password provided? Y
  • Remove anonymous users?  Y
  • Disallow root login remotely?  Y
  • Remove test database and access to it?  Y
  • Reload privilege tables now?  Y
To enhance the security of XWiki modifying the XWiki config file. Use the vim editor to open an XWiki config file:

sudo vi /etc/xwiki/xwiki.cfg

Find the two lines shown below:

xwiki.authentication.validationKey=totototototototototototototototo xwiki.authentication.encryptionKey=titititititititititititititititi

Change  both values with two different random strings, and just make sure that the length of each string is the same as the other one, for example:

xwiki.authentication.validationKey=m01s0dfa6ga141e920d5e1056184c03n xwiki.authentication.encryptionKey=a8hku91rw235tgjdnvkegmns91ab1ges

Save and quit:

:wq!

Restart Tomcat 9 in order to bring all of your modifications into effect:

sudo systemctl restart tomcat9.service

Enable Tomcat 9 in order to start the application automatically after every  restart:

sudo systemctl enable tomcat9.service


Modify UFW firewall rules in order to allow web access on port 8080:

sudo ufw allow 8080 
sudo ufw enable


By default, since Tomcat can serve more than one application at the same time, you need to access your XWiki site at the URL http://localhost:8080/xwiki

In the next blog, we will see  how to add an SSL certificate for xwiki using Nginx and how to short the URL of xwiki
Hope you enjoyed my blog post.😎

Comments

Popular posts from this blog

How to pass parameters in webhook?

Access and modify all the resources of our Wiki.js using WikiJS API

Fahrenheit to Celsius