How to Install DokuWiki on NixOS Latest
DokuWiki is a simple and efficient wiki software built for teams and individuals. In this tutorial, we will go through the steps to install DokuWiki on a NixOS latest.
Prerequisites
Before we begin, make sure that the following requirements are met:
- A server running NixOS latest.
- A non-root user with sudo privileges.
Step 1: Update System
The first step is to update your system to the latest version. Open your terminal and run the following command:
sudo nix-channel --update && sudo nixos-rebuild switch
Step 2: Install Required Packages
DokuWiki requires the following packages to be installed on the system:
- PHP.
- PHP extensions for Apache.
- Apache web server.
- SQLite.
To install them, run the following command:
sudo nix-env -i php php_packages.apache php_packages.sqlite apache
Step 3: Download DokuWiki
Download the latest stable version of DokuWiki from the official website using the following command:
curl -O https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
Extract the downloaded file to the Apache web server’s document root directory,
sudo tar -xvf dokuwiki-stable.tgz -C /var/www/
sudo mv /var/www/dokuwiki-* /var/www/dokuwiki
Step 4: Configure Apache for DokuWiki
To configure Apache to serve DokuWiki, we will create a new virtual host. To create a new virtual host, create a new configuration file /etc/httpd/sites-available/dokuwiki.conf with the following content:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/dokuwiki
ServerName your-domain.com
ErrorLog /var/log/httpd/dokuwiki-error.log
CustomLog /var/log/httpd/dokuwiki-access.log combined
<Directory /var/www/dokuwiki/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Replace your-domain.com with your actual domain name or server IP address. Also, make sure to enable mod_rewrite module using the following command:
sudo ln -s /etc/nixos/modules/services/web-servers/apache-rewrite.nix /etc/nixos/modules/services/web-servers/apache/rewrites/dokuwiki.nix
Step 5: Enable the Apache Virtual Host
To enable the newly created virtual host, run the following command:
sudo a2ensite dokuwiki
Step 6: Restart Apache
Restart the Apache service using the following command:
sudo systemctl restart apache
Step 7: Access DokuWiki
Now, it's time to access the DokuWiki installation by going to your server's IP address or domain name in your browser. You should see the DokuWiki setup page, where you can start configuring your new wiki.
Conclusion
Congratulations! You have successfully installed DokuWiki on NixOS latest. You can now start creating and collaborating on a new wiki with DokuWiki!