1080*80 ad

Installing DokuWiki on Rocky Linux

Deploy Your Own Wiki: A Complete Guide to Installing DokuWiki on Rocky Linux

In the world of knowledge management, having a centralized, easy-to-use platform is essential. DokuWiki stands out as a powerful and lightweight wiki software solution. Unlike many alternatives, DokuWiki is “database-less,” meaning it stores all its data in simple text files. This makes it incredibly fast, easy to back up, and simple to manage, making it a perfect choice for personal notes, team documentation, or public knowledge bases.

This comprehensive guide will walk you through the entire process of installing and configuring DokuWiki on a Rocky Linux server (versions 8 or 9). We will use the Apache web server and PHP to create a secure and stable environment for your new wiki.

Prerequisites

Before we begin, ensure you have the following ready:

  • A server running a fresh installation of Rocky Linux.
  • Access to a user account with sudo or root privileges.
  • A fully qualified domain name (FQDN) like wiki.yourdomain.com pointing to your server’s IP address (optional but highly recommended for a professional setup).

Step 1: Update Your System and Install Dependencies

First, it’s crucial to ensure your system is up-to-date. Open your terminal and run the following command to update all packages:

sudo dnf update -y

Next, we need to install the necessary components for our web server environment: Apache and PHP. DokuWiki requires several PHP extensions to function correctly.

Install Apache, PHP, and the required PHP extensions with a single command:

sudo dnf install -y httpd php php-gd php-xml php-json

Once the installation is complete, enable and start the Apache web server service so it runs automatically on boot:

sudo systemctl enable --now httpd

Step 2: Download and Prepare DokuWiki

Now, let’s download the latest stable version of DokuWiki. You can find the latest version on the official DokuWiki download page. We will use wget to download the archive directly to our server.

Navigate to the /tmp directory and download the files:

cd /tmp
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz

Once the download is complete, extract the archive:

tar xvf dokuwiki-stable.tgz

This will create a directory named something like dokuwiki-202X-XX-XX. For simplicity, let’s move this directory to its final destination in /var/www/html and rename it to dokuwiki.

sudo mv dokuwiki-*/ /var/www/html/dokuwiki

Step 3: Set Correct File Permissions and Ownership

Proper permissions are critical for both the functionality and security of DokuWiki. The web server needs to be able to write to certain directories to save pages, upload media, and manage configurations.

Change the ownership of the DokuWiki directory to the Apache user, which is apache on Rocky Linux:

sudo chown -R apache:apache /var/www/html/dokuwiki

This command recursively changes the owner and group for all files and directories inside your DokuWiki installation.

Step 4: Configure Apache for DokuWiki

To serve DokuWiki correctly, we need to create a dedicated Apache Virtual Host file. This tells Apache how to handle requests for your wiki’s domain.

Create a new configuration file:

sudo nano /etc/httpd/conf.d/dokuwiki.conf

Paste the following configuration into the file. Be sure to replace wiki.yourdomain.com with your actual domain name. If you are just testing locally, you can use your server’s IP address.

<VirtualHost *:80>
    ServerName wiki.yourdomain.com
    DocumentRoot /var/www/html/dokuwiki

    <Directory /var/www/html/dokuwiki>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog /var/log/httpd/dokuwiki_error.log
    CustomLog /var/log/httpd/dokuwiki_access.log combined
</VirtualHost>

Save the file and exit the editor (Ctrl+X, then Y, then Enter).

To apply the new configuration, test it for syntax errors and then restart Apache:

sudo apachectl configtest
sudo systemctl restart httpd

If configtest returns “Syntax OK,” you’re good to go.

Step 5: Configure Firewall and SELinux

Security is paramount. We need to configure the system’s firewall to allow web traffic. We also need to set the correct SELinux context, a common step missed in many guides for Red Hat-based systems like Rocky Linux.

Allow HTTP (port 80) traffic through firewalld:

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

If you plan to use an SSL certificate later, you should also add the https service.

Next, set the proper SELinux security context for the DokuWiki directory to allow Apache to write files:

sudo chcon -t httpd_sys_rw_content_t /var/www/html/dokuwiki/ -R

Step 6: Run the DokuWiki Web Installer

With the server-side configuration complete, you can now finish the installation through your web browser.

Navigate to http://wiki.yourdomain.com/install.php.

You will be greeted with the DokuWiki installer page. Here’s what you need to fill in:

  • Wiki title: The name of your new wiki.
  • Superuser: The username for your administrator account.
  • Full Name & Email: Your administrator details.
  • Password: A strong password for the admin account.
  • Initial ACL policy: This controls default permissions. “Open Wiki” allows anyone to read and edit, “Public Wiki” allows anyone to read but only registered users to edit, and “Closed Wiki” requires all users to log in. Choose the one that best fits your needs.

Once you have filled out the form, click “Save.”

Step 7: Final Security Cleanup

After a successful installation, DokuWiki will display a critical security warning.

For security reasons, you must delete the installer file. Failure to do so leaves your wiki vulnerable to being reconfigured by anyone.

Remove the install.php file from your server with this command:

sudo rm /var/www/html/dokuwiki/install.php

Congratulations! You have successfully installed DokuWiki on your Rocky Linux server. You can now visit your domain (http://wiki.yourdomain.com) and log in with the superuser account you created to start building your knowledge base. From here, you can explore thousands of plugins and templates to customize your wiki to your exact needs.

Source: https://kifarunix.com/install-dokuwiki-on-rocky-linux/

900*80 ad

      1080*80 ad