In this demo, we are going to learn how to install DokuWiki on Debian 11. 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.
DokuWiki is feature rich. Read about the features on DokuWiki features page.
Table of Contents
Installing DokuWiki on Debian 11
Run system update
Update and upgrade your system packages;
apt update
Install PHP and Required PHP Modules
DokuWiki is a PHP based web application. It requires PHP and some PHP extensions installed in order to function correctly.
Install PHP 8.1
DokuWiki, as of this writing, compatible with PHP 8.0 and 8.1.
To install PHP 8.1 on Debian 11 for DokuWiki, check the guide below;
Install Dokuwiki Required PHP modules
Install required PHP 8.1 modules for DokuWiki on Debian 11;
apt install libapache2-mod-php8.1 php8.1-xml php8.1-mbstring php8.1-zip php8.1-intl php8.1-gd
Install Apache Web Server
Apache is used as web server for DokuWiki in this demo. When PHP is installed, it installs Apache as one of its required package dependency. To confirm this use the list
option of apt
command;
apt list apache2 -a
Listing... Done
apache2/stable,now 2.4.54-1~deb11u1 amd64 [installed,automatic]
apache2/stable-security 2.4.52-1~deb11u2 amd64
Assuming that for some weird reasons Apache is not installed with PHP, run the command below to install it.
apt install apache2 -y
Start and enable Apache to run on system boot.
systemctl enable --now apache2
Open Apache Port on Firewall
To allow external access to your DokuWiki, you need to open Apache port on firewall (UFW) if at all it is running.
The port to open depends on the traffic being server, which in this case is just basic HTTP (port 80).
ufw allow 80/tcp
or simply;
ufw allow Apache
or if you are planning on using HTTPS;
ufw allow "Apache Full"
Install DokuWiki
DokuWiki is distributed as a ready to run application. All you need to do is download the distribution tarball and extract it to your web root directory;
Download the latest release version from DokuWiki download’s page. You can simply run the command below to get it;
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
Unpack DokuWiki Tarball to your web root directory, /var/www/html/dokuwiki
, in our case;
mkdir /var/www/html/dokuwiki
tar xzf dokuwiki-stable.tgz -C /var/www/html/dokuwiki/ --strip-components=1
This will extract the application files on to our web root directory, /var/www/html/dokuwiki/
.
ls -1 /var/www/html/dokuwiki
bin
conf
COPYING
data
doku.php
feed.php
inc
index.php
install.php
lib
README
vendor
VERSION
Create Apache VirtualHost for DokuWiki
To create a VirtualHost config file for DokuWiki, simply proceed as follows making the relevant changes as per your environment setup.
vi /etc/apache2/sites-available/dokuwiki.conf
<VirtualHost *:80>
ServerName dokuwiki.kifarunix-demo.com
DocumentRoot /var/www/html/dokuwiki
<Directory ~ "/var/www/html/dokuwiki/(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/apache2/dokuwiki_error.log
CustomLog /var/log/apache2/dokuwiki_access.log combined
</VirtualHost>
Save and exit the configuration file.
There are some DokuWiki files and directories that needs to be protected.
The use of AllowOverride All
allows the use of .htaccess
files. As such, rename the DokuWiki .htaccess file as shown below;
cp /var/www/html/dokuwiki/.htaccess{.dist,}
Set the ownership of the DokuWiki web root directory to www-data
.
chown -R www-data: /var/www/html/dokuwiki
Check Apache for any syntax errors;
apache2ctl -t
If you get the Syntax OK output, then you good. Otherwise, fix any error.
Syntax OK
Disable the default Apache test site;
a2dissite 000-default.conf
Enable the DokuWiki site;
a2ensite dokuwiki.conf
Reload Apache;
systemctl reload apache2
Complete DokuWiki Setup on Debian 11
To complete the setup, access your DokuWiki from the browser, http://<server-IP-or-hostname>/install.php
.
Pay attention to the Initial ACL Policy.
Set the name of the wiki, enable the ACL and other settings.
Save the configurations and continue to your DokuWiki.
To login to your DokuWiki, click Log in at the top right corner.
To make further configurations after login, click Admin gear icon at the top right corner.
Beautiful. That is all on installing DokuWiki on Debian 11. Explore the tool further and make your own tweaks. Enjoy.