Install and run DokuWiki the most versatile Wiki on a CentOS 7 VPS

In the following article, we’ll explain how you can install and run DokuWiki on a CentOS 7 server. We support DokuWiki running on all our SSD VPS hosting plans and with our DokuWiki hosting stack, you’ll get DokuWiki pre-loaded on your virtual server, making your wiki up and running in no-time.


What is DokuWiki?

DokuWiki is considered to be the most versatile open source Wiki software application which is proven to meet your demanding wiki needs.

DokuWiki does not require a database and it’s extremely simple and easy to use. Its features are available here.

System Requirements?



Before proceeding with the actual DokuWiki installation, ssh to your CentOS 7 SSD VPS, initiate a screen session and upgrade your system using yum:

## screen -U -S dokuwiki-screen
## yum update



Install some useful packages on your CentOS SSD powered virtual server:

## yum install wget unzip vim



In this set-up we are going to serve DokuWiki using the Apache 2.4 webserver, so install Apache on your CentOS 7 using the following yum command:

## yum install httpd openssl mod_ssl

Once installed, restart Apache and add it to automatically start on your system start-up using:

## systemctl restart httpd
## systemctl status httpd
## systemctl enable httpd

Now let’s configure some extra Apache options, for example, hide its version number, its banner etc… by adding the following to /etc/httpd/conf.d/options.conf

## vim /etc/httpd/conf.d/options.conf

TraceEnable off

## Disable Signature
ServerSignature Off

## Disable Banner
ServerTokens Prod

Test Apache configuration file and restart the webserver for the changes to take effect:

## apachectl configtest
## systemctl restart httpd
## systemctl status httpd



Since DokuWiki relies on PHP, we have to add PHP support to the Apache webserver by installing the following packages:

## yum install php php-gd

Although DokuWiki operates with the default PHP settings, it is recommended to tune your PHP configuration (php.ini) as described here. At least you should edit your /etc/php.ini and set the following:

## vim /etc/php.ini

expose_php = Off

restart Apache using systemctl for the changes to take effect:

## systemctl restart httpd
## systemctl status httpd

Test if PHP module is loaded in Apache using:

## httpd -M | grep php


## php -v



We’ll use wiki.mydomain.com to access the DokuWiki installation, so we would have to create an Apache Virtual Host directive. So, create /etc/httpd/conf.d/vhosts.conf and add the following:

## cat /etc/httpd/conf.d/vhosts.conf

# Load my vhosts
IncludeOptional vhosts.d/*.conf

This tells Apache, to load the configuration files ending with .conf which reside in /etc/httpd/vhosts.d. As you can guess, this is the place where we put the Virtual Hosts, so let’s set-up one for wiki.mydomain.com

VHOST for wiki.mydomain.com
## mkdir /etc/httpd/vhosts.d
## vim /etc/httpd/vhosts.d/wiki.mydomain.com.conf

<VirtualHost YOUR_SERVER_IP:80>
    ServerAdmin webmaster@mydomain.com
    DocumentRoot "/var/www/html/dokuwiki"
    ServerName wiki.mydomain.com
    ServerAlias www.wiki.mydomain.com
    ErrorLog "/var/log/httpd/wiki.mydomain.com-error_log"
    CustomLog "/var/log/httpd/wiki.mydomain.com-access_log" combined

    <Directory "/var/www/html/dokuwiki/">
        DirectoryIndex index.php
        Options FollowSymLinks
        AllowOverride All
        Require all granted

restart apache for the changes to take effect:

## systemctl restart httpd
## systemctl status httpd



First thing to do is to go to DokuWiki’s download page and download the latest stable version of DokuWiki.

## wget -P /tmp http://download.dokuwiki.org/out/dokuwiki-de8b19be26a1d74ba5bd5e075dbb7996.tgz

once the archive is downloaded, extract it to /var/www/html using:

## tar zxf /tmp/dokuwiki-de8b19be26a1d74ba5bd5e075dbb7996.tgz -C /var/www/html

set-up proper ownership using the chown command:

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

and open http://wiki.mydomain.com/install.php in your favorite browser to initiate the DokuWiki installer. You should get something like this:

once you complete the installer, you can safely remove the install.php script located withing your DokuWiki document root in /var/www/html/dokuwiki

## rm -f /var/www/html/dokuwiki/install.php



Now you have your DokuWiki up and running, so you may want to check its manual at https://www.dokuwiki.org/manual and also learn more about its syntax at https://www.dokuwiki.org/wiki:syntax


Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install Apache and DokuWiki. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Categories: Tutorials