XWiki Snap Guide
Description
XWiki-jetty Snap
Based on the XWiki Demo package modified to be production ready. It includes all the Java connectors required for the supported databases. This is the current XWiki Snap (Other Snaps have been decommissioned).
Source
XWiki-base-Snap
This Snap is based on the XWiki War package.It also includes Tomcat9 and all the supported Java connectors. The following Snap has been retired. Source
XWiki-mysql-snap
This Snap is also based on the XWiki War package. The Snap includes Tomcat9, MySQL, and the MySQL java connector.The following Snap has also been discontinued.
Source
Installation
You can download and install the snap from the Snapcraft Store
Generally for ubuntu users with preinstalled snapd can install it by using the following command:
sudo snap install xwiki
Getting Started
To Start XWiki
After installing the snap you can start XWiki with the command
sudo xwiki.start
To Stop XWiki
If an instance of XWiki is running, you can stop it with the command
sudo xwiki.stop
To upgrade XWiki
Just enter sudo snap refresh xwiki ,it would automatically update your snap and copy your permanent directory and config files.
Configuration
Configure your database
XWiki snap comes preconfigured with HSQL database . This database is not recomended for production enviorment.Refer to the following link for more information on HSQLDB(link).
Install and configure the database you wish to use:
- HSQL Installation
- MySQL Installation
- MariaDB
- PostgreSQL
- Oracle
- DB2 Installation
- Derby Installation
- Microsoft SQL Server Installation
- H2 Installation
Building XWiki snap
Prerequisites to build
You'll need to perform 3 mandatory steps to build the snap :
- install snapd
- installing snapcraft and multipass
- building the XWiki snap
Run the following commands to install snapcraft and multipass after installing snapd :
sudo snap install snapcraft --classic
sudo snap install multipass
Building the snap
- clone the repository
- cd into xwiki-jetty
- run snapcraft
This will build the xwiki_13.10.8_amd64.snap
Installing the snap
Make sure you are in the directory where the snap is built
sudo snap install xwiki_13.10.8_amd64.snap --dangerous
Releasing new version of the snap (XWiki release manager)
To release a new version of XWiki snap is fairly simple
- First you would replace the `Source:` in xwiki part here with the newer zip file link.
- Change the version name here .
- lastly you would change the version variable name in override-build of xwiki part & override-prime in scripts part
Thats all you need to do if there are no major changes in the XWiki-jetty package .
Now you can simply build the snap following the above guide.
If there some other configuration or package changes :
To change the java version
- First change the stage package to the desired java version package here.
- Then rename the java folder from 11 to your desired version here
- Change the cacerts and blacklisted.certs accordingly here
- Change the java home variable folder here
Now build the snap to see if everything works as desired .
To add another java connector or replace already existing
- add or replace the java connector in the scripts folder of the repository .
- move the connector inside the lib/ folder .similar to this
Now build the snap to see if there are any errors.
Setting up the xwiki-base-snap mysql database (obsolete)
- Make sure you have mysql 5.7 or greater installed.
- Start the MySQL server. You can do that in several ways. For example use mysqld
console - Create the wiki database.
mysql -u root -e "create database xwiki default character set utf8mb4 collate utf8mb4_bin" - Create the xwiki user with password xwiki
mysql -u root -e "CREATE USER 'xwiki'@'localhost' IDENTIFIED BY 'xwiki'"; - Give privileges to the xwiki user for accessing and creating databases (for the multi wiki support). Specifically, the xwiki users need permissions to be able to execute CREATE DATABASE, DROP SCHEMA, and then all CRUD operations on tables. Note that the command below should be tuned to be more restrictive as granting all permissions is not required:
mysql -u root -e "grant all privileges on *.* to xwiki@localhost" - The mysql JDBC Driver JAR and hibernate.cfg.xml have already been configured for mysql in the snap
- Restart the snap
sudo snap restart xwiki.tomcat - now you can launch xwiki: http://localhost:8080/xwiki/bin/view/Main/
Setting up the xwiki-mysql-snap (obsolete)
This snap consist of three parts:
- xwiki-14.4.1
- tomcat-9.0.x
- mysql-8
The building would be similar to xwiki-base-snap except the installation part:
install the snap in devmode:
sudo snap install xwiki_14.4.1_amd64.snap --devmode
Running the snap a system service (obsolete)
Running mysql as a system service requires root access, but the server itself should never run as root, so it drops privileges to a dedicated user. This user must own the server files and directories. Currently snapd blocks access to creating users and changing process user, so the only way to do this is to disable the restrictions by installing the snap with the devmode argument.
post installation steps:
sudo snap connect xwiki:process-control :process-control
xwiki.startup
xwiki.client -uroot -p
This should start the mysql server . Then follow the steps mentioned in Setting up the xwiki-base-snap mysql database section and your mysql would be ready .
now you can launch xwiki: http://localhost:8080/xwiki/bin/view/Main/
Files and directories (obsolete)
The first time you run mysql.startup, it will generate the following in $HOME/snap/xwiki/common (if run as root, /var/snap/xwiki/common is used instead):
- conf/my.cnf: Basic configuration file
- data/: Data directoriy
- files/: Default location for the secure-file-priv option
- log/: Location of error log
- run/: Location of sock and pid files