DokuWiki is a lightweight and easy-to-use open-source wiki software that does not require a database. It is widely used for documentation and collaborative content management. This guide will walk you through installing DokuWiki on Ubuntu, Debian, AlmaLinux, and Rocky Linux.
Prerequisites
Before installing DokuWiki, ensure you have the following:
-
A server running Ubuntu 22.04/20.04, Debian 11/10, AlmaLinux 9/8, or Rocky Linux 9/8.
-
Root or sudo access.
-
A LAMP or LEMP stack installed (Apache/Nginx and PHP).
-
Git and unzip installed.
Step 1: Update Your System
Update your package lists and upgrade installed packages:
sudo apt update && sudo apt upgrade -y # For Ubuntu/Debian
sudo dnf update -y # For AlmaLinux/Rocky
Step 2: Install Required Packages
Install Apache/Nginx, PHP, and other dependencies:
# For Ubuntu/Debian
sudo apt install apache2 php php-cli php-xml php-mbstring php-curl unzip git -y
# For AlmaLinux/Rocky
sudo dnf install httpd php php-cli php-xml php-mbstring php-curl unzip git -y
Start and enable services:
sudo systemctl enable --now apache2 # Ubuntu/Debian
sudo systemctl enable --now httpd # AlmaLinux/Rocky
Step 3: Download and Set Up DokuWiki
Navigate to the web root and download DokuWiki:
cd /var/www/
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz -O dokuwiki.tgz
sudo tar -xvzf dokuwiki.tgz
sudo mv dokuwiki-* /var/www/html/dokuwiki
Set correct permissions:
sudo chown -R www-data:www-data /var/www/html/dokuwiki
sudo chmod -R 755 /var/www/html/dokuwiki
Step 4: Configure Apache/Nginx
Apache Virtual Host Configuration
Create a new virtual host file:
sudo nano /etc/apache2/sites-available/dokuwiki.conf
Add the following content:
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/dokuwiki
ServerName your-domain.com
<Directory /var/www/html/dokuwiki>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enable the site and restart Apache:
sudo a2ensite dokuwiki.conf
sudo systemctl restart apache2
Nginx Configuration
Create a new Nginx configuration file:
sudo nano /etc/nginx/conf.d/dokuwiki.conf
Add the following content:
server {
listen 80;
server_name your-domain.com;
root /var/www/html/dokuwiki;
index doku.php;
location / {
try_files $uri $uri/ /doku.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php-fpm.sock;
fastcgi_index doku.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Restart Nginx:
sudo systemctl restart nginx
Step 5: Finalize DokuWiki Installation
-
Open your browser and visit
http://your-domain.com/install.php
. -
Follow the on-screen setup wizard.
-
Create the admin user and set up your wiki.
-
Delete the
install.php
file for security:
sudo rm /var/www/html/dokuwiki/install.php
Conclusion
You have successfully installed DokuWiki on Ubuntu, Debian, AlmaLinux, or Rocky Linux. Your wiki platform is now ready to use. To enhance security, enable SSL with Let’s Encrypt and configure a firewall.