DokuWiki is a popular open-source wiki software that is written in PHP. It is known for its simplicity, flexibility, and ease of use. In this article, we will show you how to install DokuWiki on an Ubuntu 20.04 server and secure it with a Let’s Encrypt SSL certificate.
Prerequisites
Before we begin, make sure that you have the following:
- A fresh Ubuntu 20.04 server with a non-root user with sudo privileges.
- Apache web server and PHP installed on your server.
- A domain name pointed to your server. In this tutorial, we will use
example.com
as our domain name.
Step 1: Install Dependencies
First, update the package index and upgrade the installed packages by running the following command:
sudo apt update
sudo apt upgrade
Next, install the dependencies required for DokuWiki by running the following command:
sudo apt install apache2 libapache2-mod-php7.4 php7.4-cli php7.4-curl php7.4-fpm php7.4-gd php7.4-json php7.4-mbstring php7.4-mysql php7.4-xml
This will install Apache web server, PHP, and other required PHP extensions.
Step 2: Download and Extract DokuWiki
Next, download the latest version of DokuWiki by running the following command:
wget <https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz>
Once the download is completed, extract the downloaded tarball by running the following command:
tar xzf dokuwiki-stable.tgz
This will extract the DokuWiki files in a directory named dokuwiki-xxxxxx
, where xxxxxx
is the version number.
Next, rename the directory to dokuwiki
and move it to the Apache web root directory:
mv dokuwiki-xxxxxx dokuwiki
sudo mv dokuwiki /var/www/html/
Next, set the ownership and permissions for the DokuWiki directory by running the following command:
sudo chown -R www-data:www-data /var/www/html/dokuwiki/
sudo chmod -R 755 /var/www/html/dokuwiki/
Step 3: Configure Apache for DokuWiki
Next, create a new Apache virtual host configuration file for DokuWiki by running the following command:
sudo nano /etc/apache2/sites-available/dokuwiki.conf
Then, add the following lines in the file:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html/dokuwiki
<Directory /var/www/html/dokuwiki>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Replace example.com
and **
www.example.com`** with your own domain name in the virtual host configuration file.
Save the file and close it.
Next, enable the virtual host by running the following command:
sudo a2ensite dokuwiki.conf
Then, enable the mod_rewrite
and ssl
Apache modules by running the following command:
sudo a2enmod rewrite ssl
Restart the Apache web server for the changes to take effect:
sudo systemctl restart apache2
Step 4: Install Let’s Encrypt SSL Certificate
DokuWiki provides a secure interface for users to access and edit the Wiki content. In order to secure your DokuWiki installation, you need to install an SSL certificate.
We will use Let’s Encrypt, a free and open-source certificate authority, to obtain an SSL certificate for your domain.
To install Let’s Encrypt, first, install the certbot
package by running the following command:
sudo apt install certbot python3-certbot-apache
Once the installation is completed, run the following command to obtain the SSL certificate for your domain:
sudo certbot --apache -d example.com -d www.example.com
Replace example.com
and www.example.com
with your own domain name.
The certbot
will ask you to provide an email address for important account notifications, and to agree to the terms of service.
Once the SSL certificate is obtained, the certbot
will automatically update your Apache virtual host configuration to use the certificate.
Step 5: Configure DokuWiki
Now, open your web browser and navigate to http://example.com
or https://example.com
, replace example.com
with your own domain name.
You will be redirected to the DokuWiki installation wizard. Follow the on-screen instructions to complete the DokuWiki configuration.
On the first page, select the desired language for your DokuWiki installation.
On the next page, select the desired license for your DokuWiki installation.
On the next page, provide a name for your DokuWiki installation and a password for the admin user.
On the next page, select the desired template for your DokuWiki installation.
On the next page, review the configuration options and click on the Finish installation
button.
This will complete the DokuWiki installation process. You will be redirected to the DokuWiki login page.
Step 6: Login to DokuWiki
Now, login to DokuWiki using the admin user credentials that you provided during the installation process.
Once you are logged in, you can start creating and editing pages in your DokuWiki installation.
Conclusion
In this tutorial, we have shown you how to install DokuWiki on an Ubuntu 20.04 server and secure it with a Let’s Encrypt SSL certificate. DokuWiki is a powerful and flexible Wiki software that can be easily customized and extended with plugins and templates. Try it out and see how it can help you create and manage your own Wiki content.