Install DokuWiki on CentOS 8

2
394

In this demo, we are going to learn how to install DokuWiki on CentOS 8 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 CentOS 8

Run system update

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

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. These can be installed by running the command below;

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      : 16.module_el8.1.0+256+ae790463
Architecture : x86_64
Size         : 5.4 M
Source       : httpd-2.4.37-16.module_el8.1.0+256+ae790463.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 on CentOS 8

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 /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>
        	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 CentOS 8, you can now access it from your preferred browser using the URL, http://server-hostname-OR-IP/install.php.

Install DokuWiki on CentOS 8

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 CentOS 8

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

Install DokuWiki on CentOS 8

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

Install DokuWiki on CentOS 8

That is all on how to install DokuWiki on CentOS 8.

Reference

DokuWiki Installation

Other Tutorials

Setup LDAP Self Service Password Tool on CentOS 8

Configure SSSD for OpenLDAP Authentication on Ubuntu 18.04

Install phpLDAPadmin on CentOS 8

Install Google Chrome Browser on CentOS 8

Implement OpenLDAP Password Policies

2 COMMENTS

  1. I have made it an habit to leave a comment every time I appreciate an article on a website or anytime I have anything I believe I have to add to the discussion currently happening. I like the manner you’ve spoken about Install DokuWiki on CentOS 8 and that’s why I am writing a comment. Would likewise be following your social media platforms every once in awhile.

LEAVE A REPLY

Please enter your comment!
Please enter your name here