How to Install XWiki on CentOS 7

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month. Get a Cloud Server

XWiki is a free wiki software platform written in Java. XWiki is an enterprise but open source wiki. It includes WYSIWYG editing, OpenDocument based document import/export, semantic annotations and tagging, and advanced permissions management.

XWiki allows you to store structured data and execute the server script within wiki interface. Scripting languages including Velocity, Groovy, Python, Ruby and PHP can be written directly into wiki pages using wiki macros. Xwiki allows you to store user defined data structures in wiki documents. You can also attach the snippet of the data structures in wiki documents, which are stored in database, later which can be queried using either Hibernate query language or XWiki's own query language.

XWiki's wiki text is rendered using XWiki Rendering Engine, which supports parsing of other wiki softwares like Confluence, JSPWiki, Creole, MediaWiki, and TWiki syntaxes as well as XWiki's own wiki syntax.

XWiki has been developed for more than 10 years and is used by many high profile companies like Amazon, EMC2, Capgemini etc for creating their knowledge base, Collaborative intranet, Public website or Business applications etc.

Features of XWiki are

Page editing with simple wiki syntax or powerful WYSIWYG editor.

Supports version control as well as access control list (ACL).

Powerful search which allows searching on the full wiki using wildcards.

Export wiki pages to PDF, ODT, RTF, XML or HTML.

Allows you to host multiple blogs and powerful file manager to manage or view your files and folders.

Supports organising meetings, discuss forums and task management.

In this tutorial we will learn how to install latest stable version of XWiki which os XWiki 8.1 on CentOS 7.

Requirements

XWiki does not have any minimum hardware requirement, but for optimal performance of JAVA 8, you will need atleast 1 GB RAM on your server. You will also need a CentOS 7 installation with root access on your server. In this tutorial we will be using root account to run the commands, if you are logged in as non root user then you can either use sudo command before all commands, or you can run sudo su to login as root user.

Installation

First of all it is important that you update the packages and repositories available in your server using the following command.

yum -y update

Now you will need to install JAVA, run the following command to download the RPM package using the following command.

wget --no-cookies --no-check-certificate --header "Cookie:oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.rpm"

If you see an error saying bash: wget: command not found , then install wget using the following command.

yum -y install wget

Once you have downloaded the RPM file, you can install the package using following command.

yum localinstall jdk-8u91-linux-x64.rpm

Now check if JAVA has been installed successfully by running the following command.

java -version

You should see following output.

[root@ip-172-31-22-139 ~]# java -version java version "1.8.0_91" Java(TM) SE Runtime Environment (build 1.8.0_91-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

Now you can move to the next step to download the setup file which is provided by XWiki using the following command.

wget http://download.forge.ow2.org/xwiki/xwiki-enterprise-installer-generic-8.1-standard.jar

Once the download finishes, you can install the package using following command.

java -jar xwiki-enterprise-installer-generic-8.1-standard.jar

Once you run the above command you will see the following message.

Jul 23, 2016 4:32:58 PM INFO: Logging initialized at level 'INFO' Jul 23, 2016 4:32:58 PM INFO: Commandline arguments: Jul 23, 2016 4:32:58 PM INFO: Detected platform: linux,version=3.10.0-327.10.1.el7.x86_64,arch=x64,symbolicName=null,javaVersion=1.8.0_91 Welcome to the installation of XWiki Enterprise 8.1! The homepage is at: http://xwiki.org/ Press 1 to continue, 2 to quit, 3 to redisplay

Now Press 1 to continue the installation. After that it will show you some more information about the software, press 1 again to continue with the installation. Now it will ask you to accept the licence, press 1 again to accept the licence. Now it will ask you to select the installation path.

Select the installation path: [/usr/local/XWiki Enterprise 8.1] Press 1 to continue, 2 to quit, 3 to redisplay

You can press enter and then 1 to use the default path, or you can also enter your custom path. Now it will ask you about the packages you want to install. First package is the core package, which is required by default hence installer will not ask you about this package, but second pack is the Default Wiki pack, it's nothing but the sample data in your Wiki. To install this pack choose Y , and choose N to not to install the package. You will see following output when the package will be installing.

[x] Pack 'Core' required ──────────────────────────────────────────────────────────────────────────────── [x] Include optional pack 'Default Wiki' ──────────────────────────────────────────────────────────────────────────────── Enter Y for Yes, N for No: y Done! Press 1 to continue, 2 to quit, 3 to redisplay 1 [ Starting to unpack ] [ Processing package: Core (1/2) ] [ Processing package: Default Wiki (2/2) ]

Now it will ask you if you want to create some shortcut, these shortcuts are used in graphical desktop, you can choose Y to add these shortcuts. If you are on console only server, then these shortcuts are not useable for you.

Finally it will ask you if you want to select the installation script. Just press enter to select the default value. It will show you that the installation is now finished.

──────────────────────────────────────────────────────────────────────────────── Generate an automatic installation script ──────────────────────────────────────────────────────────────────────────────── Enter Y for Yes, N for No: y Select the installation script (path must be absolute)[/usr/local/XWiki Enterprise 8.1/auto-install.xml] Installation was successful application installed on /usr/local/XWiki Enterprise 8.1 [ Writing the uninstaller data ... ] [ Console installation done ]

Now our software been installed in our server. This method of installation does not require further configuration and you can start the XWiki server immediately using the following commands.

cd /usr/local/XWiki Enterprise 8.1 bash start_xwiki.sh

It is important that you run above script either in root user account or as sudo privileges, because the above script is going to start some processes and allocate some memory to them.

Now you will see some messages continuously popping up on terminal. You will see something similar to the output shown below.

Starting Jetty on port 8080, please wait... 2016-07-23 18:11:11.874:INFO::main: Logging initialized @368ms 2016-07-23 18:11:12.190:INFO:oejs.Server:main: jetty-9.2.13.v20150730 2016-07-23 18:11:12.206:INFO:oejs.AbstractNCSARequestLog:main: Opened /usr/local/XWiki Enterprise 8.1/data/logs/2016_07_23.request.log 2016-07-23 18:11:12.209:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/usr/local/XWiki%20Enterprise%208.1/jetty/contexts/] at interval 0 2016-07-23 18:11:17,481 [main] INFO o.x.s.s.i.EmbeddedSolrInstance - Starting embedded Solr server... 2016-07-23 18:11:17,502 [main] INFO o.x.s.s.i.EmbeddedSolrInstance - Using Solr home directory: [data/solr] 2016-07-23 18:11:22,505 [main] INFO o.x.s.s.i.EmbeddedSolrInstance - Started embedded Solr server. 2016-07-23 18:11:33.405:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@3cbbc1e0{/xwiki,file:/usr/local/XWiki%20Enterprise%208.1/webapps/xwiki/,AVAILABLE}{/xwiki} 2016-07-23 18:11:33.451:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@514b247b{/,file:/usr/local/XWiki%20Enterprise%208.1/webapps/root/,AVAILABLE}{/root} 2016-07-23 18:11:33.460:INFO:oejs.ServerConnector:main: Started ServerConnector@1f251bf1{HTTP/1.1}{0.0.0.0:8080} 2016-07-23 18:11:33.460:INFO:oejs.Server:main: Started @21955ms 2016-07-23 18:11:33.460:INFO:oxtjl.NotifyListener:main: ---------------------------------- 2016-07-23 18:11:33.474:INFO:oxtjl.NotifyListener:main: Server started, you can now open http://52.40.97.46:8080/ in your browser to access your wiki.

Now go to the following address in your favorite web browser.

http://your-server-IP:8080

You will see following screen there.

HP_NO_IMG/data/uploads/users/2a78e75d-343a-47ce-9d84-14a6ba54abbc/1258756096.png" alt="" />

Please allow some time initialize XWiki, the page will automatically refresh to show you the progress. Once done it will automatically show you the XWiki interface.

HP_NO_IMG/data/uploads/users/2a78e75d-343a-47ce-9d84-14a6ba54abbc/479486198.png" alt="" />

XWiki is now up and running on your server. To stop the server, press Ctrl + C button on your keyboard. You can also change the port on which server runs, using the following argument with the starting script during starting the server.

bash start_xwiki.sh -p 80

Now if you execute the above command then Jetty server will start on port number 80 , which is default port for http service. Make sure that no other service is currently using the port. Now you can access your server without using any port number on it, XWiki can be browsed using the following address.

http://your-server-IP

You can make the port change permanent by setting up a Global variable JETTY_PORT in your system. Run the following command for same.

echo 'export JETTY_PORT=80' >> ~/.bash_profile source ~/.bash_profile

Now you can run the start script again to run the XWiki software.

Automatically Start XWiki at Boot time

To automatically start the software at boot time you can run the following commands.

echo "source ~/.bash_profile" >> /etc/rc.d/rc.local echo "bash /usr/local/XWiki Enterprise 8.1/start_xwiki.sh" >> /etc/rc.d/rc.local chmod +x /etc/rc.d/rc.local

The first command will add the command to rc.local file which automatically executes at boot time. Next command ensures that the rc.local file gets executed at boot up. Now if you restart your server, you will see that the XWiki has automatically started on port 80 as we have specified this port to run Jetty server.

To stop the running server at your server run the following command.

bash /usr/local/XWiki Enterprise 8.1/stop_xwiki.sh

You should see following output on terminal.

Attempting to stop XWiki cleanly on port 80...

If you see any error saying Lock file [/var/tmp/xwiki-8080.lck] is missing. Aborting stop. . Then try the following command.

bash /usr/local/XWiki Enterprise 8.1/stop_xwiki.sh -p 80

Logging into the Admin Panel

By default XWiki comes with an administrative account with username Admin ( A is in uppercase) and password admin . To login to your Administrative Panel, run the start script and browse your XWiki through your favorite web browser. Now click on Log-in links, which can be found on right sidebar of dashboard. You can login into XWiki using the credentials provided above.

HP_NO_IMG/data/uploads/users/2a78e75d-343a-47ce-9d84-14a6ba54abbc/1955684219.png" alt="" />

Once you are logged in you will many options at left sidebar.

HP_NO_IMG/data/uploads/users/2a78e75d-343a-47ce-9d84-14a6ba54abbc/1272063660.png" alt="" />

It is important that you change your Admin user's password as soon as possible. To change your password, go to your profile by clicking on the profile icon on the menu bar at right. In the profile of the Administrator, click on preference tab, then in preference click on Change Password button.

HP_NO_IMG/data/uploads/users/2a78e75d-343a-47ce-9d84-14a6ba54abbc/1008018908.png" alt="" />

You can use this interface to set a strong password for your XWiki wiki.

Enabling Superadmin Account

XWiki comes with a Superadmin account, but by default this account is disabled. Superadmin account is very powerful because the password of Superadmin account is not stored in database but it is stored in configuration files, hence it cannot be modified in any way. Regardless of whatever your configuration of ACL might be, it has always full access to the application. Superadmin account can be used for recovery of Admin user.

To enable Superadmin account, edit the configuration file of XWiki with your favorate editor.

nano /usr/local/XWiki Enterprise 8.1/webapps/xwiki/WEB-INF/xwiki.cfg

Now scroll down to find the following lines.

#--------------------------------------- # Authentication and authorization # #-# Enable to allow superadmin. It is disabled by default as this could be a #-# security breach if it were set and you forgot about it. Should only be enabled #-# for recovering the Wiki when the rights are completely messed. #xwiki.superadminpassword=

To enable superadmin account, remove the comment before xwiki.superadminpassword= and provide a strong password for your superadmin user as shown below.

xwiki.superadminpassword=StrongPassword

Save the file and exit from editor. Restart your application, by first stopping the application and then stating it again. Now you can log-in to your XWiki using username superadmin and Your newly created password.

Conclusion

In this tutorial we have learned to install XWiki on CentOS 7 using standalone installer provided by XWiki. Additionally we learned to run XWiki at boot time. Now you can also create a full featured Wiki using XWiki to host your wikis or documentation.