Installing Dokuwiki on Alpine Linux Latest

Dokuwiki is a popular wiki software that allows users to create and manage their own wikis. In this tutorial, we will be showing you how to install Dokuwiki on Alpine Linux Latest.

Prerequisites

Before we begin the installation process, ensure that you have the following prerequisite:

Let's Start Installation

Follow the below steps for the successful installation of Dokuwiki on Alpine Linux:

1. Update the system

It is always recommended to update the system before installing any software. Use the following command to update the system.

apk update && apk upgrade

2. Install the required dependencies

To install Dokuwiki, we require the following PHP modules:

Use the following command to install these dependencies:

apk add php7 php7-fpm php7-session php7-xml php7-gd php7-zip php7-mbstring php7-json

3. Install Nginx

We also require a web server to serve the Dokuwiki pages. Here, we will be using Nginx web server.

Use the following command to install Nginx:

apk add nginx

4. Configure Nginx

Create a new configuration file for Nginx.

nano /etc/nginx/conf.d/dokuwiki.conf

Paste the following content in it.

server {
    listen 80;
    server_name your_domain.com;
 
    root /var/www/dokuwiki/;
    index index.php;
 
    error_log /var/log/nginx/dokuwiki_error.log;
    access_log /var/log/nginx/dokuwiki_access.log;
 
    location / {
        try_files $uri $uri/ @dokuwiki;
    }
 
    location @dokuwiki {
        rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
        rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
        rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
        rewrite ^/(.*) /doku.php?id=$1 last;
    }
 
    location ~ \.php$ {
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Save and exit the editor.

5. Install Dokuwiki

Use the following command to download and install the Dokuwiki in the web directory.

wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
 
tar xvf dokuwiki-stable.tgz
mv dokuwiki-*/ /var/www/dokuwiki

Set the appropriate permission for the newly created directories.

chown -R nginx:nginx /var/www/dokuwiki/

7. Start the server

To start the Nginx and PHP-FPM services, use the below command:

rc-update add nginx default
rc-update add php7-fpm default
rc-service nginx start
rc-service php7-fpm start

That's it! You have now successfully installed and configured Dokuwiki on Alpine Linux Latest. You can access it by entering your domain name in the browser.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!