XWiki – Install
This is to create a installation of XWiki on a installation of Rocky Linux already installed
Configuration
Linux configuration
Disable selinux
Run the following or you can modify the file here, “/etc/sysconfig/selinux”. If you modify the file make sure you still run the “setenforce 0” or just simply reboot after modification.
setenforce 0 sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config Disable firewall
systemctl disable firewalld.service Epel Release
dnf install epel-release -y After Epel install
dnf upgrade -y Server Software Configuration
Install MySQL on the server
Install Java
dnf install java-11-openjdk -y dnf install java-11-openjdk-devel -y Verify the Viserion after install
java -version Results
openjdk version "11.0.24" 2024-07-16 LTS OpenJDK Runtime Environment (Red_Hat-11.0.24.0.8-2) (build 11.0.24+8-LTS) OpenJDK 64-Bit Server VM (Red_Hat-11.0.24.0.8-2) (build 11.0.24+8-LTS, mixed mode, sharing) Install MariaDB
Install the server
sudo dnf install mariadb-server -y Modify the my.cnf server file
sudo vi /etc/my.cnf.d/mariadb-server.cnf Make modifications the file and append under the current settings in the [mysql] section
#Custom Entries performance_schema = ON tmpdir = /run/mariadb thread_cache_size = 4 table_open_cache = 16384 table_definition_cache = 8384 sql_mode = ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION query_cache_type = 0 query_cache_size = 0 query_cache_limit = 128M query_cache_strip_comments = 1 tmp_table_size = 512M max_heap_table_size = 512M max_connections = 512 max_allowed_packet = 24M sort_buffer_size = 24M join_buffer_size = 48M innodb_buffer_pool_size = 4G innodb_buffer_pool_instances = 4 innodb_use_native_aio = 1 innodb_flush_log_at_trx_commit = 0 innodb_file_per_table innodb_log_file_size = 512M #Optional config if using transaction log. log_bin = /var/log/mariadb/mariadb.log expire_logs_days = 2 Reload for changes
sudo systemctl daemon-reload Start and enable on boot
systemctl enable --now mariadb.service Add the XWiki user to access the database
mysql create database xwiki default character set utf8mb4 collate utf8mb4_bin; grant all privileges on xwiki.* to 'xwiki'@'localhost' identified by 'xwiki_password'; grant all privileges on xwiki.* to 'xwiki'@'%' identified by 'xwiki_password'; FLUSH PRIVILEGES; exit; Tomcat Configuration
Verify which version you want to install, we will be using “v9.0.63”
http://dlcdn.apache.org/tomcat/tomcat-9 Create folder for Tomcat
sudo mkdir /opt/tomcat sudo cd /opt/tomcat Replace the version within the following link
wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.93/bin/apache-tomcat-9.0.93.tar.gz Extract the file you downloaded in you current folder
sudo tar xvf apache-tomcat-*.tar.gz -C /opt/tomcat --strip-components=1 Create the tomcat user
sudo groupadd tomcat sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat Change the permissions on the tomcat folder
sudo chown -R tomcat: /opt/tomcat Configuring Systemd Service
sudo vi /etc/systemd/system/tomcat.service Add the following content to the file
[Unit] Description=Tomcat 9 servlet container After=network.target [Service] Type=forking User=tomcat Group=tomcat Environment="JAVA_HOME=/usr/lib/jvm/jre" Environment="CATALINA_PID=/opt/tomcat/temp/tomcat.pid" Environment="CATALINA_HOME=/opt/tomcat" Environment="CATALINA_BASE=/opt/tomcat" Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC" Environment="JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom" ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/opt/tomcat/bin/shutdown.sh [Install] WantedBy=multi-user.target Enable and start the Tomcat service:
sudo systemctl daemon-reload sudo systemctl enable tomcat sudo systemctl start tomcat Adjusting the Firewall and you did not run the firewall disabling command above, allow traffic to Tomcat's default port 8080
sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp sudo firewall-cmd --reload Securing Tomcat
Edit the web.xml file to disable directory listing and add security constraints to the manager and host-manager applications. It's also advisable to change the default shutdown port and command in server.xml.
Add access from another host if needed
vi /opt/tomcat/webapps/manager/META-INF/context.xml Add the IP or IPs you are accessing from to allow access to the main tomcat page. you will need to change this entry from this “allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1” />" to something like this
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1|192.168.253.100|192.168.252.2" /> Configure XWiki
Download the war file
cd /opt/tomcat/webapps wget -O wiki.war https://nexus.xwiki.org/nexus/content/groups/public/org/xwiki/platform/xwiki-platform-distribution-war/15.10.11/xwiki-platform-distribution-war-15.10.11.war systemctl restart tomcat Reverse Proxy
Change for reverse proxy settings
sudo vi /opt/tomcat/webapps/wiki/WEB-INF/xwiki.cfg Change the following in the file
To point to a specific domain
xwiki.home=http://wiki.sflservicesllc.com Change to use https
xwiki.url.protocol=https MySQL Setup
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/webapps/wiki/WEB-INF/lib/ wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.jar chown tomcat:tomcat mysql-connector-java-5.1.49.jar MariaDB Setup
After the Tomcat service is restarted move to the XWiki’s WEB-INF/lib directory and download the MariaDB JDBC Driver JAR:
su - tomcat cd /opt/tomcat/webapps/wiki/WEB-INF/lib/ wget https://dlm.mariadb.com/3852266/Connectors/java/connector-java-3.4.1/mariadb-java-client-3.4.1.jar chown tomcat:tomcat mariadb-java-client-3.4.1.jar Open the WEB-INF/hibernate.cfg.xml file and configure XWiki to use MySQL:
vi /opt/tomcat/webapps/wiki/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"/> --> Uncomment wither the MySQL Section or the MariaDB section and change the password
<property name="hibernate.connection.username">xwiki</property> <property name="hibernate.connection.password">xwiki_password</property> Restart the Tomcat service
sudo systemctl restart tomcat Accessing Tomcat
Open your web browser and navigate to the following below. You should see the default Tomcat landing page.
http://[your_server_ip]:8080/wiki https://linuxhostsupport.com/blog/how-to-install-xwiki-on-centos-7/
https://reintech.io/blog/installing-configuring-tomcat-rocky-linux-9