In this tutorial we are going to learn how to install DokuWiki on Ubuntu 20.04.
DokuWiki is easy to use and simple open-source wiki software it that doesn’t require a database. Something that doesn’t require any storage space is something incredible. Lets highlight it more.
The reason why we need this wiki software is that, it is easy to install and use, it doesn’t require specialized system requirements such as storage space, RAM, it has high language base support, its open-source and also device independent.
We have other alternatives apart from DokuWiki such as: confluence, clickup, notion, xwiki, bloomfire, yext, guru and many more.
Installing DokuWiki on Ubuntu 20.04
Installing DokuWiki on Debian based system is easy because it is found on the Debian repository, but it is not the best way to do install. The reasons being:
- Packages found might be outdated
- The packages replaces some of the Dokuwiki’s internal libraries which again can cause incompatibilities.
- Debian uses different directory structure, which can cause issues with some plugins
- Apache webserver
- Ubuntu 20.04
- basic understanding of the command line
1. Update system repositories.
The best way to start installing any software is to run system updates in order to make repositories up to date hence avoid running into some errors during installation process.
$ sudo apt update && apt upgrade -y
When updates and upgrades are complete, we can move forward and install apache2
2. Install Apache2
The reason why we require apache is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.
To install Apache check this article: How to Install Apache, MYSQL, PHP on Ubuntu 20.04.
$ sudo apt install apache2 -y
Enable and start Apache service on start.
# start $ sudo systemctl start apache2 # enable $ sudo systemctl enable apache2 # status $ sudo systemctl status apache2
# status ● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2022-02-24 17:45:58 UTC; 2min 13s ago Docs: https://httpd.apache.org/docs/2.4/ Main PID: 15564 (apache2) Tasks: 55 (limit: 1132) Memory: 5.2M CGroup: /system.slice/apache2.service ├─15564 /usr/sbin/apache2 -k start ├─15566 /usr/sbin/apache2 -k start └─15567 /usr/sbin/apache2 -k start
The next thing is to adjust the firewall settings to accept Http and Https traffic. In order to allow apache full control run the following command:
$ sudo ufw allow "Apache Full"
3. Install DokuWiki dependencies.
In order to install DokuWiki, we need to install some dependencies such as apache-mod-php. To install those dependencies run the following command.
$ sudo apt install php libapache2-mod-php php-xml
The next thing is to restart apache server for the changes to take effect.
$ sudo systemctl restart apache2
4. Download latest release of DokuWiki.
We are going to download and extract dokuwiki from archive. First lets download using wget command.
# cd into www directory $ cd /var/www # download dokuwiki $ sudo wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
After the download is complete, extract it from the archives
$ sudo tar xvf dokuwiki-stable.tgz
Then we need to move the extracted archive to dokuwiki directory.
$ sudo mv dokuwiki-*/ dokuwiki
Also we need to change read and write permission to allow it to run whenever we called it.
$ sudo chown -R www-data:www-data /var/www/dokuwiki
The next thing is to change the document root in Apache to point to /var/www/dokuwiki
$ sudo vim /etc/apache2/sites-enabled/000*.conf
We need to replace DocumentRoot /var/www/html with DocumentRoot /var/www/dokuwiki.
NB: If you want to host a DokuWiki server on localhost for testing purposes do NOT change the content of
/etc/apache2/sites-enabled/000*.conf, instead create a new file in
/etc/apache2/sites-available with the following code. Because mine is testing purpose I will go this route.
$ sudo touch apache2-dokuwiki.conf
Input the following content onto the file
<VirtualHost 127.0.0.1> DocumentRoot /var/www/dokuwiki ServerName localhost </VirtualHost>
Then we need to enable the new project by placing it into /etc/apache2/sites-enabled
$ sudo a2ensite apache2-dokuwiki
Reload apache2 again
$ sudo systemctl reload apache2
Lastly is to change allowoverides settings on Apache 2 to use .htaccess files for security
$ sudo vim /etc/apache2/apache2.conf
In the directory /var/www/ replace Allowoveride None with Allowoveride All and then restart Apache2
$ sudo systemctl restart apache2
When all those is over, visit http://<your_IP_Address>/install.php to run your configurations.
Thank you for staying with me during this tutorial, I hope you have learned something new. Incase you have any difficulty don’t hesitate to contact us or see the DokuWiki documentations for further reading.