In this tutorial, we are going to show you how to install and configure DokuWiki on CentOS Stream 8 with Apache webserver and (currently) the latest PHP 8.0.

Docuvic There is a popular open-source wiki software that you can expand and customize with lots of plugins and themes. It does not use a database, it is lightweight, and DokuWiki has very good syntax.

Prerequisites

This is what you will need to set up DokuWiki:

  • A server. $ 3.50 per month JM to VPS Enough to run DokuWiki. Use the CentOS Stream 8 image. You can also use other CentOS versions, the instructions will be somewhat similar.
  • An experience in managing and using servers. All the commands below are supposed to run through SSH (Terminal), so if you are a beginner, this tutorial may not be a good fit for you. All the commands below are executed by the root user, so running ‘sudo’ is not necessary. If you are using a non-root user, you must update the command accordingly.
  • It is assumed that your server is already updated and secure. This tutorial is only on how to set up and configure DokuWiki.

Step 1: Update your server

Before installing or configuring new software on your software, the first thing you always need to do is update:

yum -y update

Step 2: Install Apache

The next step is to install the webserver, in which case, we will use Apache.

yum -y install httpd

Step 3: Configure your firewall

In most cases, the firewall in CentOS is pre-configured and enabled. You must update your firewall to allow HTTP and / or HTTPS traffic. In this tutorial, we will use firewall. Then, run the following command:

firewall-cmd --permanent --zone=public --add-service={http,https}
firewall-cmd --reload

This will add rules and restart the firewall service.

Step 4: Install PHP 8

PHP 8 is not included by default in CentOS 8’s repository. The first thing you need to do is to enable EPEL and the Remy repository by running these commands:

yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
yum install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm

Then, enable the PHP 8 module:

yum module enable php:remi-8.0 -y

And now you can finally install PHP 8 and some PHP extensions:

yum install -y php php-cli php-common php-gd php-mbstring php-mysqlnd php-xml

Step 5: Download Document

Next, you will need to download DokuWiki. For this tutorial, we will use the latest stable release.

To download the latest stable release of DokuWiki, run the following command:

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

And extract the archive into the folder in which you plan to run DokuWiki. For this tutorial, we will use the default Apache webroot folder:

tar zxvf dokuwiki-stable.tgz -C /var/www/html/ --strip-components=1

Step 6: Set up. Htaccess, apache, and SELinux

The next step is to set up an .htaccess file and set up Apache.

You can use a pre-configured .htaccess file:

cp /var/www/html/.htaccess.dist /var/www/html/.htaccess

The next step to update permissions is:

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

To run DokuWiki properly, you must configure SELinux. Run the following command:

semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/conf(/.*)?"

semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/data(/.*)?"

semanage permissive -a httpd_t

restorecon -Rv /var/www/html/conf

restorecon -Rv /var/www/html/data

The next step is to star, enable and restart the httpd daemon:

systemctl start httpd
systemctl enable httpd
systemctl restart httpd

Step 7: Install DokuWiki

And finally, you can install DokuWiki by going to the install.php page which is located in your root folder. It must be something

http://your-domain.name/install.php

That page is very self-explanatory.

Next Step

The documentation of DokuWiki is very simple for whatever you are trying to do or solve. The two pages we recommend are Security page And this user manual. Make sure that you have properly protected your server as well as DokuWiki.