FedoraRHEL Based

How To Install DokuWiki on Fedora 42

Install DokuWiki on Fedora 42

DokuWiki stands out as a versatile, lightweight wiki software solution that doesn’t require a database for operation. This makes it an excellent choice for both personal documentation needs and organizational knowledge management. Fedora 42, the latest release of this robust Linux distribution, provides an ideal platform for running DokuWiki with minimal configuration hassle. This comprehensive guide will walk you through every step of installing and configuring DokuWiki on your Fedora 42 system, ensuring you have a fully functional wiki ready for your content creation needs.

Understanding DokuWiki

DokuWiki is an open-source wiki software that focuses on simplicity and ease of use. Unlike other wiki platforms that require complex database setups, DokuWiki stores all its data in plain text files. This approach offers several advantages including easier backup procedures, simpler troubleshooting, and lower system requirements.

Key benefits of DokuWiki include:

  • No database requirement
  • Simple syntax for content creation
  • Extensive plugin ecosystem
  • Built-in access control systems
  • Version control for all content changes

Prerequisites for Installation

Before beginning the installation process, ensure your Fedora 42 system meets the following requirements:

  • A Fedora 42 server with root or sudo privileges
  • Minimum 1GB RAM (2GB recommended for better performance)
  • At least 1GB free disk space
  • Basic command-line knowledge
  • A domain name (optional but recommended for production environments)
  • Basic understanding of web servers and PHP applications

Most Fedora 42 installations will comfortably exceed these minimal requirements, but it’s worth verifying your system specifications before proceeding.

Updating Your Fedora 42 System

Always begin any installation process by ensuring your system is fully updated. This step is crucial as it helps prevent compatibility issues and security vulnerabilities.

To update your Fedora 42 system, execute the following commands:

sudo dnf check-update
sudo dnf upgrade -y

The first command checks for available updates, while the second command applies them. The `-y` flag automatically confirms the installation without prompting.

After updating, it’s a good practice to reboot your system to ensure all updates are properly applied:

sudo systemctl reboot

Installing Apache Web Server

DokuWiki requires a web server to function, and Apache is one of the most popular and well-supported options available on Fedora 42.

To install Apache HTTP Server, run:

sudo dnf install httpd -y

Once installed, start the Apache service and enable it to launch automatically on system boot:

sudo systemctl start httpd
sudo systemctl enable httpd

Verify that Apache is running correctly by checking its status:

sudo systemctl status httpd

You should see output indicating that the service is active and running. You can also test Apache by opening a web browser and navigating to `http://localhost` or your server’s IP address. You should see the default Apache test page.

Installing PHP and Required Extensions

DokuWiki is written in PHP and requires several PHP extensions to function properly. Fedora 42 repositories include compatible PHP packages that work well with DokuWiki.

Install PHP and the required extensions with:

sudo dnf install php php-cli php-fpm php-xml php-gd php-mbstring php-json php-opcache php-iconv php-curl -y

This comprehensive command installs PHP along with all the essential extensions DokuWiki needs for proper operation. After installation, verify that PHP is working correctly by creating a test file:

echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php

Now access `http://localhost/info.php` in your browser. You should see the PHP information page displaying your PHP version and configured extensions. Remember to remove this file after testing for security reasons:

sudo rm /var/www/html/info.php

Downloading DokuWiki

There are two methods to obtain DokuWiki on Fedora 42: using the package manager or downloading directly from the official website.

Method 1: Installing via Package Manager

Fedora 42 includes DokuWiki in its repositories, making installation straightforward:

sudo dnf install dokuwiki dokuwiki-selinux -y

The `dokuwiki-selinux` package is essential as it configures SELinux to allow DokuWiki to write to its configuration files properly.

Method 2: Manual Download and Installation

Alternatively, you can download the latest stable version directly from the official DokuWiki website:

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

This approach ensures you have the most recent release, which might include features or fixes not yet available in the Fedora repository version.

Extracting and Configuring DokuWiki Files

If you installed DokuWiki via the package manager, the files are already in place. For manual installation, you need to extract the downloaded archive and move the files to the web server directory:

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

Next, ensure proper ownership and permissions for the DokuWiki files:

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

This command assigns ownership to the Apache user, allowing the web server to read and write to the DokuWiki files as needed. The correct permissions are crucial for DokuWiki’s proper functioning, especially for features like plugin installation and configuration changes.

Configuring Apache for DokuWiki

For better organization and security, it’s recommended to create a dedicated Apache virtual host configuration for DokuWiki.

Create a new configuration file:

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

Add the following configuration, adjusting the domain name as needed:

<VirtualHost *:80>
    ServerAdmin webmaster@example.com
    DocumentRoot /var/www/html/dokuwiki
    ServerName wiki.example.com

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

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

For Fedora 42 with Apache 2.4, ensure you use `Require all granted` to allow remote access to your wiki.

Save the file and reload Apache to apply the changes:

sudo systemctl reload httpd

Handling SELinux for DokuWiki

Fedora uses SELinux by default, which can restrict DokuWiki’s ability to write to its configuration files. The `dokuwiki-selinux` package handles most of the necessary configurations, but you may need to apply additional settings.

If you encounter permission issues, apply the following SELinux contexts:

sudo semanage fcontext -a -t httpd_sys_rw_content_t '/etc/dokuwiki(/.*)?'
sudo semanage fcontext -a -t httpd_sys_content_t '/usr/share/dokuwiki(/.*)?'
sudo semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/dokuwiki/lib/plugins(/.*)?'
sudo restorecon -R '/etc/dokuwiki'
sudo restorecon -R '/usr/share/dokuwiki'

These commands configure SELinux to allow DokuWiki to function properly while maintaining system security.

Configuring Firewall

For your DokuWiki installation to be accessible from other computers, you need to configure the firewall to allow HTTP and HTTPS traffic:

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

Verify the firewall configuration:

sudo firewall-cmd --list-all

You should see `http` and `https` listed among the allowed services.

Completing the Web Installation

With all the server configurations in place, it’s time to complete the DokuWiki installation through the web interface.

Open your web browser and navigate to:

  • `http://your-server-ip/dokuwiki/install.php` (for package installation)
  • or `http://your-server-ip/dokuwiki/install.php` (for manual installation)

Install DokuWiki on Fedora 42

The installation wizard will guide you through the final setup steps:

  1. Set your wiki title and administrator account details
  2. Configure the ACL (Access Control List) policy
  3. Select your default license for wiki content
  4. Choose whether to enable anonymous usage data collection

After completing these steps, click “Save” to finalize the installation.

Once the installation is successful, remove the install.php file to prevent unauthorized reconfigurations:

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

Post-Installation Security Hardening

Enhancing your DokuWiki’s security is essential, especially for publicly accessible installations:

1. Configure access control: Review and adjust the ACL settings in DokuWiki’s admin interface to ensure proper user permissions.

2. Protect sensitive files: Ensure that configuration files are not accessible directly through the web browser:

sudo nano /var/www/html/dokuwiki/.htaccess

Add or uncomment these lines:

# Disable access to .git, .htaccess and other sensitive files
RedirectMatch 404 /\.git
RedirectMatch 404 /\.htaccess
RedirectMatch 404 /conf/.*
RedirectMatch 404 /data/.*
RedirectMatch 404 /inc/.*

3. Implement HTTPS: For production environments, secure your wiki with HTTPS using Let’s Encrypt:

sudo dnf install certbot python3-certbot-apache -y
sudo certbot --apache -d wiki.example.com

4. Regular backups: Set up automated backups of your DokuWiki data directory:

sudo mkdir /var/backups/dokuwiki
sudo rsync -av /var/www/html/dokuwiki/data/ /var/backups/dokuwiki/

Consider scheduling this command with cron for automatic backups.

Advanced Configuration Options

DokuWiki offers numerous advanced configuration options to enhance your wiki experience:

Enabling URL Rewriting

For cleaner URLs, enable URL rewriting by editing the main configuration file:

sudo nano /etc/dokuwiki/local.php

Add or modify these lines:

$conf['userewrite'] = 1;
$conf['useslash'] = 1;

These settings enable URL rewriting and slash-separated page names, which are beneficial for SEO.

Customizing Appearance

DokuWiki supports themes (templates) to change its appearance. Install a new template:

sudo mkdir -p /var/www/html/dokuwiki/lib/tpl/your-template
sudo unzip template.zip -d /var/www/html/dokuwiki/lib/tpl/your-template
sudo chown -R apache:apache /var/www/html/dokuwiki/lib/tpl/your-template

Select the new template in the Admin → Configuration Settings interface.

Enhancing SEO

Improve search engine visibility by installing the Keywords and Description plugins:

sudo dnf install dokuwiki-plugin-keywords dokuwiki-plugin-description -y

These plugins allow you to add metadata to your wiki pages, improving their search engine rankings.

Troubleshooting Common Issues

Despite careful installation, you might encounter some issues. Here are solutions to common problems:

Permission Problems

If DokuWiki can’t write to configuration files:

sudo chown -R apache:apache /etc/dokuwiki
sudo chmod -R 775 /etc/dokuwiki

SELinux-Related Issues

If you encounter “Internal Server Error” despite correct file permissions:

sudo setsebool -P httpd_can_network_connect 1
sudo setsebool -P httpd_unified 1

Page Not Found Errors

If pages don’t display correctly after enabling URL rewriting:

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

Add this inside the “ section:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

PHP Extension Problems

If DokuWiki reports missing PHP extensions:

sudo dnf install php-{missing-extension} -y
sudo systemctl restart php-fpm httpd

Maintenance and Updates

Keeping your DokuWiki installation updated is important for security and functionality:

Updating via Package Manager

For package installations:

sudo dnf update dokuwiki -y

Manual Updates

For manually installed DokuWiki:

1. Back up your data:

sudo cp -r /var/www/html/dokuwiki/data /var/backups/dokuwiki-data-$(date +%Y%m%d)
sudo cp -r /var/www/html/dokuwiki/conf /var/backups/dokuwiki-conf-$(date +%Y%m%d)

2. Download and extract the new version:

cd /tmp
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
sudo tar -xzf dokuwiki-stable.tgz -C /var/www/html/dokuwiki-new

3. Move your data and configuration:

sudo cp -r /var/www/html/dokuwiki/data/* /var/www/html/dokuwiki-new/data/
sudo cp -r /var/www/html/dokuwiki/conf/* /var/www/html/dokuwiki-new/conf/

4. Replace the old installation:

sudo mv /var/www/html/dokuwiki /var/www/html/dokuwiki-old
sudo mv /var/www/html/dokuwiki-new /var/www/html/dokuwiki
sudo chown -R apache:apache /var/www/html/dokuwiki

5. Run the upgrade script in your browser:

http://your-server-ip/dokuwiki/bin/upgrade.php

Congratulations! You have successfully installed DokuWiki. Thanks for using this tutorial for installing DokuWiki on your Fedora 42 Linux 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