Install DokuWiki on Ubuntu 22.04

Today, I will teach you how you can install DokuWiki on Ubuntu 22.04. DokuWiki is a free and open-source wiki software that does not use a database. DokuWiki is written in PHP and it is simple to install and use in addition to being platform independent.

Cool features of DokuWiki

  • Highly easier to use
  • Extensible with multiple support for layout templates, plugins and community
  • Easy to integrate with syndication and backend
  • Access Control and Anti-Spam Measures
  • International language support
  • Fast with full text search and page caching

    Before you install DokuWiki on Ubuntu 22.04, you need to have the meet the prerequisites below.

Prerequisites

  • Stable internet for downloading required packages
  • Root privileges for installation
  • A web server
  • PHP

Install PHP

  • Update system packages
sudo apt update && sudo apt upgrade -y
  • Ubuntu 22.04 has PHP 8 in its repository but DokuWiki is well supported. Keep in mind that PHP 5.6 is the minimum supported version. Do some tweaks to install PHP 7.4
sudo add-apt-repository ppa:ondrej/php --yes &> /dev/null
sed -i 's/jammy/focal/' /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list
sudo apt update
  • For some reason Ubuntu 22.04 seems to be having broken packages. So ensure that libssl is installed. You may need to run apt update after this too.
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb
sudo dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb
  • Now install PHP 7.4 and required modules
sudo apt install php7.4 php7.4-gd php7.4-xml php7.4-json libapache2-mod-php7.4 -y

Install Apache Web Server

  • Installation of PHP installs Apache2 server automatically. Confirm is Apach2 was installed. If a path is printed, it is installed, otherwise, it is not.
which apache2
  • If it is not installed, install using the command:
sudo apt install apache2 -y
  • Start and enable apache2 server on system start
sudo systemctl enable --now apache2

Allow HTTP access through firewall.

Ubuntu 22.04 has UFW as the firewall although it is not enabled by default. In case yours is running, you need to allow HTTP traffic through port 80.

sudo ufw allow Apache

Install DokuWiki on Ubuntu 22.04

There is DokuWiki package ready for installation. Download the latest version from DokuWiki download’s page.

  • Alternatively, grab the file using wget.
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
  • Create a folder to store web root files
sudo mkdir -p /var/www/html/dokuwiki
  • Extract the files to the folder above
sudo tar xzf dokuwiki-stable.tgz -C /var/www/html/dokuwiki/ --strip-components=1
  • Then copy relevant files for DokuWiki
sudo cp /var/www/html/dokuwiki/.htaccess{.dist,}
  • Give DokuWiki ownership to the DokuWiki directory
sudo chown -R www-data: /var/www/html/dokuwiki

Create Apache VirtualHost for DokuWiki

  • Create a new file in /etc/apache2/sites-available .
sudo nano /etc/apache2/sites-available/apache2-dokuwiki.conf
  • Enter the content below and replace server name accordingly
<VirtualHost *:80>
        ServerName    localhost      
        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>
  • Enable the virtual host configuration
sudo a2ensite apache2-dokuwiki
  • Restart apache2 to effect the changes
sudo service apache2 reload

Finish DokuWiki installation

Open your browser and enter the URL http://your-server-name/install.php i.e. http://localhost/install.php

  • Enter the details to access DokuWiki. Ensure you select the correct ACL policy.
  • Once the installation is complete, click on your new DokuWiki.
  • You will be presented with a welcome screen. Click on log in to access the admin page.
  • Login page open. Enter your username and password your created earlier.
  • Your will be directed to the dashboard. Click on admin to open the admin interface
  • Delete the install.php file after this stage.
sudo rm /var/www/dokuwiki/install.php

Conclusion

You have come to the end of this article on how to install DokuWiki in Ubuntu 22.04. Find more advanced features and configurations on DokuWiki documentation

Other interesting articles

Install CockroachDB on Ubuntu 22.04

How to Setup Samba Server on Ubuntu 22.04

Configure Static IP Address on Ubuntu 22.04

Android Developer | Linux | Technical Writer | Backend Developer

Leave a Comment