How to Install XWiki on CentOS 7

XWiki is an open-source, enterprise-level wiki platform written in Java. It’s one of the most popular and most capable open source wikis out there. Some of its useful features include WYSIWYG editing, OpenDocument based document import/export, semantic annotations and tagging, and advanced permissions management. The large and knowledgeable community is always available for help and they keep updating and improving the wiki software. You can check their official playground (demo) to learn more about the features that XWiki offers.

This tutorial is written and tested for a CentOS 7 Cloud Server

Log in to your CentOS 7 VPS via SSH as user root

ssh root@IP_Address

And make sure that all installed packages are up to date

yum -y update

Install MySQL database server

yum -y install mysql

Start the database server and enable it to start at system boot

systemctl start mysql
systemctl enable mysql

and create a new MySQL and user for XWiki

mysql -u root -p

mysql> CREATE DATABASE xwiki DEFAULT CHARACTER SET utf8;
mysql> GRANT ALL ON xwiki.* TO 'xwikiuser'@'localhost' IDENTIFIED BY 'PASSWORD';
mysql> FLUSH PRIVILEGES;
mysql> exit

XWiki is Java based platform, so we have to install java on the VPS.

yum -y install java

Check if it is successfully installed with the following command

java -version
openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-b15)
OpenJDK 64-Bit Server VM (build 25.111-b15, mixed mode)

Install Tomcat

yum -y install tomcat

Install JDBC driver for MySQL

yum -y install mysql-connector-java

Copy the MySQL connector file to Tomcat’s ‘lib’ directory

cp /usr/share/java/mysql-connector-java.jar /usr/share/tomcat/lib/

Once Tomcat is installed on your server, change the current working directory to the webapps directory and download XWiki

cd /usr/share/tomcat/webapps
wget http://download.forge.ow2.org/xwiki/xwiki-enterprise-web-8.4.3.war

rename the war file to something simpler

mv xwiki-enterprise-web-8.4.3.war xwiki.war

Restart Tomcat to deploy the downloaded XWiki war file and enable it to start at boot time

systemctl restart tomcat
systemctl enable tomcat

Now, open the ‘hibernate.cfg.xml’ file with a text editor and comment out the whole ‘Configuration for the default database’ part and uncomment the ‘MySQL configuration’ part. It should look like this:

nano /usr/share/tomcat/webapps/xwiki/WEB-INF/hibernate.cfg.xml

<!-- MySQL configuration.
Uncomment if you want to use MySQL and comment out other database configurations.
Notes:
- if you want the main wiki database to be different than "xwiki"
you will also have to set the property xwiki.db in xwiki.cfg file
-->
<property name="connection.url">jdbc:mysql://localhost/xwiki?useSSL=false</property>
<property name="connection.username">xwikiuser</property>
<property name="connection.password">PASSWORD</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<property name="dbcp.poolPreparedStatements">true</property>
<property name="dbcp.maxOpenPreparedStatements">20</property>
<mapping resource="xwiki.hbm.xml"/>
<mapping resource="feeds.hbm.xml"/>
<mapping resource="activitystream.hbm.xml"/>
<mapping resource="instance.hbm.xml"/>
<mapping resource="mailsender.hbm.xml"/>

Don’t forget to change the necessary information for the MySQL database.

Save the changes and restart Tomcat again for the changes to take effect.

systemctl restart tomcat

With this step, the installation of XWiki on a CentOS 7 VPS is completed. Access the XWiki installation at http://yourdomain.com:8080/xwiki, create your administrative user and you can start creating your own wiki website.


Of course, you don’t have to do any of this if you use one of our Linux Cloud Hosting services, in which case you can simply ask our expert Linux admins to install XWiki for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment