Install DokuWiki on Rocky Linux

|
Last Updated:
|
|

In this demo, we are going to learn how to install DokuWiki on Rocky Linux server. DokuWiki is an opensource software written in PHP that allows users to create and edit pages using a web browser. It works on plain texts and requires no database. Read about the features provided by the DokuWiki on DokuWiki features page.

Install DokuWiki on Rocky Linux

Run system update

To begin with, ensure your system packages are up-to-date.

dnf update

Install PHP and Other Required PHP Modules

DokuWiki is a PHP based web application which requires PHP and some other PHP extensions to function correctly.

By default, PHP 7.2 stream repos are enabled on Rocky Linux. In order to be able to install PHP 7.4 in Rocky Linux, reset PHP 7.2 repos and enable PHP 7.4 repos;

dnf module -y reset php
dnf module -y enable php:7.4

Next, run the command below to install PHP and required DokuWiki modules;

dnf install php php-gd php-xml php-json

Run Apache Web Server

In this demo, we are using Apache as our web server for DokuWiki. Apache is installed alongside PHP.

dnf info httpd
Installed Packages
Name         : httpd
Version      : 2.4.37
Release      : 43.module+el8.5.0+747+83fae388.3
Architecture : x86_64
Size         : 4.3 M
Source       : httpd-2.4.37-43.module+el8.5.0+747+83fae388.3.src.rpm
Repository   : @System
From repo    : appstream
Summary      : Apache HTTP Server
URL          : https://httpd.apache.org/
License      : ASL 2.0
Description  : The Apache HTTP Server is a powerful, efficient, and extensible
             : web server.

If not installed for some reasons, run the command below to install it.

dnf install httpd

Next, start and enable Apache to run on system boot.

systemctl enable --now httpd

Allow Apache through Firewall

To remotely allow HTTP traffic to the DokuWiki server, you need to open port 80 on firewall. Otherwise, for HTTPS, open port 443. This demo is using HTTP, hence open port 80/TCP by running the command below;

firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload

Install DokuWiki

DokuWiki installation is as simple as downloading the application itself and placing it on the default web root directory.

Download Stable Release Version

Navigate to DokuWiki download’s page and grab the latest release version. You can simply run the command below to download the current stable release version of DokuWiki.

dnf install wget
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz

Extract DokuWiki Tarball

Once the download is complete, run the command below to extract DokuWiki to the default web root directory, which is /var/www/html in this demo.

dnf install tar
tar xzf dokuwiki-stable.tgz  --strip-components=1 -C /var/www/html/

This will extract DokuWiki and place it on /var/www/html/.

ls -1 /var/www/html/
bin
conf
COPYING
data
doku.php
feed.php
inc
index.php
install.php
lib
README
vendor
VERSION

Create Apache VirtualHost for DokuWiki

Create an Apache VirtualHost for DokuWiki as shown below;

vi /etc/httpd/conf.d/dokuwiki.conf
<VirtualHost *>
	ServerName    dokuwiki.kifarunix-demo.com
	DocumentRoot  /var/www/html

	<Directory ~ "/var/www/html/(bin/|conf/|data/|inc/)">
	    <IfModule mod_authz_core.c>
                AllowOverride All
        	Require all denied
	    </IfModule>
	    <IfModule !mod_authz_core.c>
	        Order allow,deny
        	Deny from all
	    </IfModule>
	</Directory>

	ErrorLog   /var/log/httpd/dokuwiki_error.log
	CustomLog  /var/log/httpd/dokuwiki_access.log combined
</VirtualHost>

Save and quit the configuration file.

Note that the line, AllowOverride All, turns on the use of htaccess file for more directory access controls. As such, rename the DokuWiki .htaccess file as shown below;

cp /var/www/html/.htaccess{.dist,}

Set the ownership of the DokuWiki web root directory to apache.

chown -R apache:apache /var/www/html

Configure SELinux Policies for DokuWiki

If SELinux is running, you need to run the commands below to configure SELinux to allow various accesses for DokuWiki.

dnf install policycoreutils-python-utils
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/conf(/.*)?"
restorecon -Rv /var/www/html/conf
restorecon -Rv /var/www/html/data
setsebool -P httpd_can_network_connect on
setsebool -P httpd_can_sendmail on
setsebool -P httpd_unified 1
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/lib/plugins(/.*)?"
restorecon -Rv /var/www/html/lib/plugins
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/lib/tpl(/.*)?"
restorecon -Rv /var/www/html/lib/tpl

If you ever get any denied access, be sure to check the audit logs;

tail -f /var/log/audit/audit.log | grep -i denied

Restart Apache

Check for any syntactical error on Apache configuration file and restart it if no issues.

httpd -t
Syntax OK
systemctl restart httpd

Finalize DokuWiki Installation

To complete the installation of DokuWiki on Rocky Linux, you can now access it from your preferred browser using the URL, http://server-hostname-OR-IP/install.php.

Set the name of the wiki, enable the ACL and other settings and click Save and continue to your DokuWiki welcome page.

Install DokuWiki on Rocky Linux

You can now login to your DokuWiki as the user created while setting up the ACL.

Install DokuWiki on Rocky Linux

If you need to make any configurations upon successful authentication, click on the Admin gear icon at the top right corner.

Install DokuWiki on Rocky Linux

That is all on how to install DokuWiki on Rocky Linux.

Reference

DokuWiki Installation

Other Tutorials

Install DokuWiki on ubuntu 22.04

Install and Setup DokuWiki on Ubuntu 20.04

How to Configure DokuWiki OpenLDAP Authentication

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
gen_too
Co-founder of Kifarunix.com, Linux Tips and Tutorials. Linux/Unix admin and author at Kifarunix.com.

Leave a Comment