RHEL BasedRocky Linux

How To Install DokuWiki on Rocky Linux 9

Install DokuWiki on Rocky Linux 9

In this tutorial, we will show you how to install DokuWiki on Rocky Linux 9. Are you looking for powerful and customizable wiki software to create and maintain documentation? Look no further than DokuWiki – the open-source wiki software that is easy to install and highly flexible. With a wide range of plugins and extensions, you can customize your wiki to fit your needs. In this guide, we’ll walk you through the process of installing and configuring DokuWiki on a Rocky Linux 9 server. So, whether you’re a seasoned IT professional or just getting started, let’s dive in and get started with DokuWiki!

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the DokuWiki on Rocky Linux. 9.

Prerequisites

  • A server running one of the following operating systems: Rocky Linux 9.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for DokuWiki.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install DokuWiki on Rocky Linux 9

Step 1. The first step is to update your system to the latest version of the package list. To do so, run the following commands:

sudo dnf check-update
sudo dnf install dnf-utils epel-release mod_ssl

Step 2. Installing Apache.

By default, Apache is available on the Rocky Linux 9 base repository. Now we install the latest version of Apache using dnf the command:

sudo dnf install httpd httpd-tools

You can start the httpd service and configure it to run on startup by entering the following commands:

sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl status httpd

To make your pages available to the public, you will have to edit your firewall rules to allow HTTP and HTTPS requests on your web server by using the following commands:

sudo firewall-cmd --permanent --zone=public --add-service=http 
sudo firewall-cmd --permanent --zone=public --add-service=https 
sudo firewall-cmd --reload

For additional resources on installing Apache, read the post below:

Step 3. Installing PHP.

PHP is a popular scripting language that powers the dynamic content of millions of websites and apps. Now we run the commands below to install PHP 8 to your Rocky Linux:

sudo dnf epel-release
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm
sudo dnf --disablerepo="*" --enablerepo="remi-safe" list available 
sudo dnf module enable php:remi-8.1

Once Remi PHP 8.1 module is enabled, you can now install PHP 8.1 and commonly used PHP extensions as follows:

sudo dnf install php php-cli php-mysqlnd php-opcache php-xml php-gd php-pdo php-bcmath php-intl php-mbstring php-json php-zip unzip

Check and verify the installed version:

php -v

For additional resources on installing PHP, read the post below:

Step 4. Installing DokuWiki on Rocky Linux 9.

Now download the latest version of the DokuWiki package from the official DokuWiki website using the following command:

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

Extract the archive using the following command:

sudo tar xf dokuwiki-stable.tgz -C /var/www/html/
sudo mv /var/www/html/dokuwiki-*/ /var/www/html/dokuwiki/

Next, we need to configure the permissions for the DokuWiki files. Run the following commands:

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

Step 5. Configuring Apache.

Now create a new virtual host for DokuWiki by creating a new Apache configuration file:

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

Add the following file:

<VirtualHost *>
	ServerName   your-domain.com
	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/httpd/dokuwiki_error.log
	CustomLog  /var/log/httpd/dokuwiki_access.log combined
</VirtualHost>

Save and close the file, then restart the Apache web server for the changes to take effect:

sudo systemctl restart httpd

Step 6. Configure SELinux.

If SELinux is running, you need to run the commands below to configure SELinux to allow various accesses for DokuWiki:

sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/dokuwiki/conf(/.*)?"
sudo restorecon -Rv /var/www/html/dokuwiki/conf
sudo restorecon -Rv /var/www/html/dokuwiki/data
sudo setsebool -P httpd_can_network_connect on
sudo setsebool -P httpd_can_sendmail on
sudo setsebool -P httpd_unified 1
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/dokuwiki/lib/plugins(/.*)?"
sudo restorecon -Rv /var/www/wiki/lib/plugins
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/dokuwiki/lib/tpl(/.*)?"
sudo restorecon -Rv /var/www/html/dokuwiki/lib/tpl

Step 7. Secure DokuWiki with Let’s Encrypt SSL.

By default, DokuWiki does not use HTTPS, which means that all data transmitted between the server and the client is sent in plaintext. To enable HTTPS, you will need to install an SSL certificate and configure your web server to use it.

First, install the Certbot client using the following command below:

sudo dnf install certbot python3-certbot-apache

Then, run the following command to generate certificates with Apache:

sudo certbot --apache

Let’s Encrypt certificates have 90 days of validity, and it is highly advisable to renew the certificates before they expire. You can test automatic renewal for your certificates by running this command:

sudo certbot renew --dry-run

Step 8. Accessing DokuWiki Web Interface.

Once successfully installed, open your web browser and access DokuWiki using the URL https://your-domain.com/install.php. You will be redirected to the following page:

Install DokuWiki on Rocky Linux 9

Congratulations! You have successfully installed DokuWiki. Thanks for using this tutorial for installing DokuWiki on your Rocky Linux 9 system. For additional help or useful information, we recommend you check the official DokuWiki website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button