Install DokuWiki on Ubuntu 22.04

|
Last Updated:
|
|

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

Install DokuWiki on Ubuntu 22.04

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.

DokuWiki, as of this writing, is not yet fully compatible with PHP 8.

Hence, you need to install PHP 7.4;

To install PHP 7.4 and the required modules for DokuWiki, run the command below;

add-apt-repository ppa:ondrej/php --yes &> /dev/null
sed -i 's/jammy/focal/' /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list
apt install php7.4 php7.4-gd php7.4-xml php7.4-json libapache2-mod-php7.4 -y

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
apache2/jammy,now 2.4.52-1ubuntu2 amd64 [installed]

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

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.

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 Ubuntu 22.04

To complete the setup, access your DokuWiki from the browser, http://<server-IP-or-hostname>/install.php.

Pay attention to the Initial ACL Policy.

dokuwiki setup

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

welcome page

To login to your DokuWiki, click Log in at the top right corner.

Install DokuWiki on ubuntu

To make further configurations after login, click Admin gear icon at the top right corner.

Install DokuWiki on ubuntu 22.04

The installation of DokuWiki on Ubuntu 22.04 is now done. Explore the tool further and make your own tweaks. Enjoy.

Reference

Install [DokuWiki]

Other Tutorials

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