How to Install DokuWiki on Ubuntu 18.04 LTS
In this tutorial, we will learn how to install DokuWiki on Ubuntu 18.04 server.
Requirements
- A server running Ubuntu 18.04.
- A static IP address 192.168.0.101 is set up on your server.
- A root password is set up to your server.
Getting Started
First, you will need to update your server with the latest version. You can do it with the following command:
apt-get update -y
apt-get upgrade -y
Once your server is updated, restart your system to apply all the changes
Install Apache, PHP
Before starting, you will need to install Apache web server, PHP and other packages to your server. You can install all of them by running the following command:
apt-get install apache2 php7.2 libapache2-mod-php7.2 php7.2-common php7.2-mbstring php7.2-xmlrpc php7.2-sqlite3 php7.2-soap php7.2-gd php7.2-xml php7.2-cli php7.2-tidy php7.2-intl php7.2-json php7.2-curl php7.2-zip unzip wget git -y
Once all the packages are installed, open php.ini file and change some settings:
nano /etc/php/7.2/apache2/php.ini
Make the following changes:
memory_limit = 256M upload_max_filesize = 100M max_execution_time = 360 date.timezone = Asia/Kolkata
Save and close the file, when you are finished. Then, start Apache service and enable it to start on boot time with the following command:
systemctl start apache2
systemctl enable apache2
Once you have done, you can proceed to the next step.
Install DokuWiki
First, you will need to download the latest version of DokuWiki from Git repository. You can download it to the Apache web root directory with the following command:
cd /var/www/html/
git clone --branch stable https://github.com/splitbrain/dokuwiki.git
Once the download is completed, give proper permissions to the dokuwiki directory with the following command:
chown -R www-data:www-data /var/www/html/dokuwiki/
chmod -R 755 /var/www/html/dokuwiki/
Once you have done. You can proceed to the next step.
Configure Apache for DokuWiki
Next, you will need to create an Apache virtual host file for DokuWiki. You can do this by creating the following file:
nano /etc/apache2/sites-available/dokuwiki.conf
Add the following lines:
VirtualHost *:80 ServerAdmin [email protected] DocumentRoot /var/www/html/dokuwiki ServerName example.com Directory /var/www/html/dokuwiki/ Options FollowSymlinks AllowOverride All Require all granted /Directory ErrorLog ${APACHE_LOG_DIR}/doku_error.log CustomLog ${APACHE_LOG_DIR}/doku_access.log combined Directory /var/www/html/dokuwiki/ RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*) index.php [PT,L] /Directory /VirtualHost
Save and close the file, when you are finished. Then, enable DokuWiki virtual host with the following command:
a2ensite dokuwiki.conf
Next, enable Apache rewrite module and restart Apache service to apply all the changes with the following command:
a2enmod rewrite
systemctl restart apache2
You can also check the status of Apache service with the following command:
systemctl status apache2
You should see the following output:
? apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d ??apache2-systemd.conf Active: active (running) since Tue 2019-04-16 14:57:32 UTC; 3s ago Process: 2358 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 2372 (apache2) Tasks: 6 (limit: 1113) CGroup: /system.slice/apache2.service ??2372 /usr/sbin/apache2 -k start ??2375 /usr/sbin/apache2 -k start ??2377 /usr/sbin/apache2 -k start ??2378 /usr/sbin/apache2 -k start ??2381 /usr/sbin/apache2 -k start ??2382 /usr/sbin/apache2 -k start May 25 02:50:11 ubuntu1804 systemd[1]: Starting The Apache HTTP Server... May 25 02:50:11 ubuntu1804 apachectl[2358]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 181. May 25 02:50:11 ubuntu1804 systemd[1]: Started The Apache HTTP Server.
Once you have done, you can proceed to the next step.
Access DokuWiki Web Interface
Open your web browser and type the URL http://example.com/install.php. You will be redirected to the following page:
Provide all the required information like superuser name, email, password. Then, click on the Save button. Once the installation has been completed successfully, you should see the following page:
Now, click on your new DokuWiki. You should see the following page:
Now, click on the login button. You will be redirected to the following page:
Now, provide your Admin username and password. Then, click on the Log In button. You should see the DokuWiki dashboard in the following page:
Congratulations! you have successfully installed and configured DokuWiki on Ubuntu 18.04 server. You can now create your own wiki site easily using DokuWiki. Feel free to ask me if you have any questions.