Dokuwiki is a free and open source wiki software. It is written in PHP and doesn’t require a database. Dokuwiki is popular because it is very simple, easy to use and has a very clean and readable syntax. It has built-in access control lists and supports over 50 languages.
In this tutorial, we will install DokuWiki on CentOS 7 server.
Requirements
DokuWiki does not require any special hardware requirements. It can be installed on servers with a small amount of RAM. All the required dependencies will be installed throughout the tutorial. You will need a minimal installation of CentOS 7 with root access on it. If you are logged in as a non-root user, you can run sudo -i
to switch to root user.
Installing DokuWiki
Before installing any package it is recommended that you update the packages and repository using the following command.
yum -y update
Once you have your system updated, you can proceed to install the Apache web server.
yum -y install httpd
DokuWiki can be installed on any version of PHP greater than 5.6. You can install PHP 7 for high performance. PHP 7 is not included in default YUM repository, hence you will need to add the Webtatic repository in your system. Webtatic repository requires EPEL repository to work. Run the following command to install EPEL repository.
yum -y install epel-release
yum -y update
Now install the Webtatic repository using the following commands.
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y update
To install PHP 7.1 and all of the required PHP modules, run the following command.
yum -y install php71w php71w-curl php71w-cli php71w-gd
Once you have PHP installed, you can check the version of PHP using the following command.
php -v
You should get output similar to this.
[root@liptan-pc ~]# php -v
PHP 7.1.3 (cli) (built: Mar 19 2017 15:31:52) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
You will also need to enable Mod_rewrite
in Apache web server by editing /etc/httpd/conf/httpd.conf
using your favorite text editor.
nano /etc/httpd/conf/httpd.conf
Find the following line.
<Directory "/var/www/html">
AllowOverride None
Change it to AllowOverride All
.
Now start the Apache web server and enable it to start at boot time using the following command.
systemctl start httpd
systemctl enable httpd
As we have all the dependencies ready, we can now download the install package from the DokuWiki site.
cd /var/www/html
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
The above command will always download the latest installer archive. Extract the archive using the following command.
tar -xvzf dokuwiki-stable.tgz
The above command will extract the package in a folder with similar name as dokuwiki-2017-02-19b
. For ease of access, you can rename the directory using the following command.
mv dokuwiki-20* dokuwiki
Now create a virtual host for the wiki application. Run the following command to do one.
nano /etc/httpd/conf.d/wiki.yourdomain.com.conf
Paste the following lines into the file.
<VirtualHost *:80>
ServerAdmin me@liptanbiswas.com
DocumentRoot "/var/www/html/dokuwiki"
ServerName wiki.yourdomain.com
ServerAlias www.wiki.yourdomain.com
ErrorLog "/var/log/httpd/wiki.yourdomain.com-error_log"
CustomLog "/var/log/httpd/wiki.yourdomain.com-access_log" combined
</VirtualHost>
Replace wiki.yourdomain.com
with any domain or subdomain you want to use to access the application. Save the file and exit from the editor. Run the following command to restart your Apache server.
systemctl restart httpd
Now you will need to provide the ownership of the application to the web server user using the following command.
chown -R apache:apache /var/www/html/dokuwiki
You may also need to allow HTTP traffic on port 80
through the firewall if you are running one. Run the following commands to do so.
firewall-cmd --zone=public --permanent --add-service=http
firewall-cmd --reload
You will also need to disable SELinux. To temporarily disable SELinux without restarting the server, run the following command.
setenforce 0
To completely disable the SELinux you will need to edit /etc/selinux/config
file.
nano /etc/selinux/config
Find the following line:
SELINUX=enforcing
Change it to:
SELINUX=disabled
Now complete the installation using a web browser, go to the following link using your favorite web browser.
http://wiki.yourdomain.com
You will see the following page asking for administrator account creation.
HP_NO_IMG/data/uploads/users/5bc5f3e0-17df-4257-afd4-59fc57ecae4e/1403469852.png” alt=”” />
Provide the name of your Wiki website. Further select the Enable ACL checkbox and provide the administrator credentials. Choose the ACL policy recommended is Public Wiki. Further, choose the license that you want to use with your content. Click Save button once done.
You will need to delete the install.php
file now. Run the following command for same.
rm /var/www/html/dokuwiki/install.php
Once done, you can now access your wiki, it will look like shown below.
HP_NO_IMG/data/uploads/users/5bc5f3e0-17df-4257-afd4-59fc57ecae4e/1484620928.png” alt=”” />
Conclusion
In this tutorial, we installed Dokuwiki on CentOS 7. You can now log in to your wiki using administrator credentials and add the content in it.