how to install xwiki on centos 7

How to Install XWiki on CentOS 7

Spread the love

instaling xwiki on centos 7In this tutorial, we are going to show you how to XWiki on CentOS 7. XWiki is a free and open-source advanced wiki software platform written in Java. It runs on servlet containers like JBoss, Tomcat, etc. which uses a database such as MySQL or PostgreSQL to store its information.

We will use a VPS with CentOS 7 but you should be able to install XWiki following this tutorial on all Red hat based Linux distributions. Installing XWiki on CentOS 7 is a fairly easy task and it shouldn’t take more than 20 minutes to finish it.

XWiki comes with tons of useful features such as the following:

  • BLog
  • Page editing
  • Content organization
  • Forums
  • Create your own applications
  • File Manager
  • Tasks
  • Different translations of the documents
  • Meetings
  • Version control
  • Content imports
    and much more…

Log in to your CentOS 7 server

Log in to your VPS via SSH as a sudo user:

ssh userame@IP_Address

Once you are logged in, issue the following commands to make sure all installed packages are up to date:

sudo yum update

Install Java

XWiki is a Java-based application so the first step is to install Java on your server. Use the following command to install OpenJDK 8 JRE using yum:

sudo yum install java-1.8.0-openjdk

Verify the installation by running:

java -version

The command above should print something like the following:

openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)

2. Download Tomcat 8

XWiki works with any Servlet Container such as Tomcat, GlassFish, JBoss, and Jetty. In this guide, we will use Tomcat.

Create a system user that will run the Tomcat service:

sudo groupadd tomcat
sudo useradd  -g tomcat -d /opt/tomcat tomcat

Before downloading Tomcat source files change to the tomcat user:

su - tomcat

Download the latest stable version of Apache Tomcat 8 from the official tomcat downloads page:

wget http://www-us.apache.org/dist/tomcat/tomcat-8/v8.0.53/bin/apache-tomcat-8.0.53.zip

When the download is completed unzip the archive by running the following command:

unzip apache-tomcat-8.0.53.zip

Move the apache-tomcat-8.0.53 directory to tomcat:

mv apache-tomcat-8.0.53 tomcat

Set the correct permissions to the startup scripts:

chmod +x tomcat/bin/*.sh

Once completed switch back to the sudo user:

exit

Create SystemD unit file

To create a SystemD unit file for Apache Tomcat 8 open your text editor and create the following file:

sudo nano /etc/systemd/system/tomcat.service

Copy and paste the following code:

[Unit]
Description=Apache Tomcat 8 Service
After=syslog.target network.target

[Service]
Type=forking

User=tomcat
Group=tomcat

Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment=CATALINA_PID=/opt/tomcat/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat/tomcat
Environment=CATALINA_BASE=/opt/tomcat/tomcat
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -XX:MaxPermSize=192m -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/opt/tomcat/tomcat/bin/startup.sh
ExecStop=/bin/kill -15 $MAINPID

[Install]
WantedBy=multi-user.target

Save and close the file.

Rn the following commands to reload units and to start the Apache Tomcat service:

sudo systemctl daemon-reload
sudo systemctl start tomcat

Enable the Apache Tomcat service to start on boot:

sudo systemctl enable tomcat

Create MySQL database

XWiki works with a lot of relational databases such as MySQL, PostgreSQL, Oracle, and Derby. In this guide, we will use MySQL.

If you don’t have MySQL or MariaDB installed on your server install it with the following command:

sudo yum install mariadb-server

Once installed set the storage engine to InnoDB. Open the MariaDB configuration file with”

sudo nano /etc/my.cnf.d/server.cnf

and add default-storage-engine = innodb in the [mysqld] section:

[mysqld]
default-storage-engine = innodb

Start and enable the MariaDB service:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Login to the MySQL server with:

mysql -u root

Create a new database and user for XWiki:

create database xwiki default character set utf8 collate utf8_bin;
grant all privileges on xwiki.* to xwiki@localhost identified by 'xwiki_password';

Download and Configure XWiki

Switch to the tomcat user:

su - tomcat

Download the latest stable version of XWiki from its official downloads page:

wget http://nexus.xwiki.org/nexus/content/groups/public/org/xwiki/platform/xwiki-platform-distribution-war/10.8/xwiki-platform-distribution-war-10.8.war

Once the download is completed, move the war file to the Tomcat webapps directory as XWiki.war

 mv xwiki-platform-distribution-war-10.8.war tomcat/webapps/xwiki.war

Switch back to the sudo user and restart the Tomcat service:

sudo systemctl restart tomcat

After the Tomcat service is restarted move to the XWiki’s WEB-INF/lib directory and download the MySQL JDBC Driver JAR:

su - tomcat
cd /opt/tomcat/tomcat/webapps/xwiki/WEB-INF/lib/
wget http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.9/mysql-connector-java-5.1.9.jar

Open the WEB-INF/hibernate.cfg.xml file and configure XWiki to use MySQL:

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

Comment out the default hsqldb database section and uncomment and edit the MySQL database section as shown below:

<!-- Configuration for the default database.
Comment out this section and uncomment other sections below if you want to use another database.
Note that the database tables will be created automatically if they don't already exist.

If you want the main wiki database to be different than "xwiki" (or the default schema for schema based engines)
you will also have to set the property xwiki.db in xwiki.cfg file
-->
<!--
<property name="connection.url">jdbc:hsqldb:file:${environment.permanentDirectory}/database/xwiki_db;shutdown=true</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>
<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>

<property name="hibernate.connection.charSet">UTF-8</property>
<property name="hibernate.connection.useUnicode">true</property>
<property name="hibernate.connection.characterEncoding">utf8</property>

<mapping resource="xwiki.hbm.xml"/>
<mapping resource="feeds.hbm.xml"/>
<mapping resource="activitystream.hbm.xml"/>
<mapping resource="instance.hbm.xml"/>
<mapping resource="notification-filter-preferences.hbm.xml"/>
<mapping resource="mailsender.hbm.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">xwiki</property>
<property name="connection.password">xwiki_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>

<property name="hibernate.connection.charSet">UTF-8</property>
<property name="hibernate.connection.useUnicode">true</property>
<property name="hibernate.connection.characterEncoding">utf8</property>

<mapping resource="xwiki.hbm.xml"/>
<mapping resource="feeds.hbm.xml"/>
<mapping resource="activitystream.hbm.xml"/>
<mapping resource="instance.hbm.xml"/>
<mapping resource="notification-filter-preferences.hbm.xml"/>
<mapping resource="mailsender.hbm.xml"/>

Switch back to the sudo user and restart the Tomcat service:
sudo systemctl restart tomcat

Access XWiki

XWiki runs on port 8080. To access your XWiki installation open your web browser and type: http://yourdomain_or_ip_address:8080/xwiki

You will be asked to create a new admin user for your XWiki and select a flavor. After the browser installation is completed, you can log in as your admin user and access your XWiki admin page.

For more information about XWiki, you can visit their official website.

 

install xwiki on centos 7If you use one of our Managed Server Support services,  you can simply ask our expert Linux admins to install XWiki on CentOS 7 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, on how to install XWiki on CentOS 7,  please share it with your friends on the social networks using the buttons below or simply leave a comment in the Comments Section below. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *