15

Install DokuWiki on Rocky Linux 8/AlmaLinux 8 With Let's Encrypt SSL | Computing...

 2 years ago
source link: https://computingforgeeks.com/install-dokuwiki-on-rocky-almalinux-with-lets-encrypt-ssl/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Install DokuWiki on Rocky Linux 8/AlmaLinux 8 With Let's Encrypt SSL

DokuWiki is an open-source wiki licensed under the GPLv2 and written in the PHP programming language. DokuWiki is highly versatile and doesn’t require a database. It is more similar to MediaWiki but more recommended since it is lightweight and more customizable.

DokuWiki was developed by Andreas Gohr in June 2004 and the first public release was made in July. With several improvements such as built-in access controls and authentication connectors, DokuWiki has become useful in the enterprise sector with innumerable plugins being added by the community to improve its functionality.

DokuWiki is highly preferred due to the following:

  • It is easy to install and use
  • Built-in Access Control Lists
  • Large variety of extensions
  • Operates on low system requirements
  • Supports over 50 languages
  • It is device independent
  • Full text search – integrated indexed search with which a user can search for keywords and phrases on the wiki.

DokuWiki can be used as:

  • Software manual
  • Private notebook
  • Corporate Knowledge Base
  • CMS – intranet
  • Project workspace

By following this guide to the end, you should be able to install DokuWiki on Rocky Linux 8 / AlmaLinux 8 With Let’s Encrypt SSL.

1. Prepare your Server

Update your system packages to their latest available versions.

sudo yum -y update

Install the required packages on your system.

sudo yum -y install git vim bash-completion curl wget unzip tar epel-release unzip socat

Set the hostname.

sudo hostnamectl set-hostname wiki.domain.com

2. Install PHP and its extensions

Since DokuWiki is written in PHP, we need to have PHP and its extensions installed before we proceed. This can be achieved using the command:

sudo dnf install php php-gd php-xml php-json

Once installed, check the PHP version.

$ php --version
PHP 7.2.24 (cli) (built: Oct 22 2019 08:28:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

3. Install DokuWiki on Rocky Linux 8 / AlmaLinux 8

The latest version of DokuWiki can be downloaded from the official DokuWiki downloads page. You can also download the latest stable version of DokuWiki as below:

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

Create the DokuWiki document root directory.

sudo mkdir -p /var/www/wiki

Extract the file and move them to the created directory.

sudo tar xzf dokuwiki-stable.tgz  --strip-components=1 -C /var/www/wiki/

Once installed, set the permission of the DokuWiki path.

sudo chown -R apache:apache /var/www/wiki

4. Configure SELinux for DokuWiki

If you have SELinux enabled, you need to make the below adjustments for the created DokuWiki path to be accessible. The easiest way to do this is to switch to permissive mode, only for the Apache service

sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/wiki/conf(/.*)?"
sudo restorecon -Rv /var/www/wiki/conf
sudo restorecon -Rv /var/www/wiki/data
sudo setsebool -P httpd_can_network_connect on
sudo setsebool -P httpd_can_sendmail on
sudo setsebool -P httpd_unified 1
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/wiki/lib/plugins(/.*)?"
sudo restorecon -Rv /var/www/wiki/lib/plugins
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/wiki/lib/tpl(/.*)?"
sudo restorecon -Rv /var/www/wiki/lib/tpl

5. Configure Apache web server for DokuWiki

We will create a virtual host file for DokuWiki as below

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

In the file, add the below lines.

<VirtualHost *>
	ServerName   wiki.domain.com
	DocumentRoot  /var/www/wiki
	<Directory ~ "/var/www/wiki/(bin/|conf/|data/|inc/)">
	    <IfModule mod_authz_core.c>
                AllowOverride All
        	Require all denied
	    </IfModule>
	    <IfModule !mod_authz_core.c>
	        Order allow,deny
        	Deny from all
	    </IfModule>
	</Directory>
	ErrorLog   /var/log/httpd/dokuwiki_error.log
	CustomLog  /var/log/httpd/dokuwiki_access.log combined
</VirtualHost>

With AllowOverride All enabled, we will rename the .htaccess file as below.

sudo cp /var/www/wiki/.htaccess{.dist,}

Start and enable apache

sudo systemctl start httpd && sudo systemctl enable httpd

Allow HTTP through the firewall.

sudo firewall-cmd --add-port=80/tcp --permanent
sudo firewall-cmd --add-port=443/tcp --permanent
sudo firewall-cmd --reload

6. Access DokuWiki Web Interface

We will proceed to configure DokuWiki via the Web using the URL http://wiki.domain.com/install.php or http://IP_address/install.php

On the above page, provide the required details. Also, make the below settings under the Initial ACL policy:

  • Open Wiki – Open for everyone
  • Public Wiki – read for all, uploads and edits for registered users
  • Closed Wiki – Access only for registered users

Save the changes made and Dokuwiki will be ready.

Proceed to the homepage by clicking on your new DokuWiki

Login by providing the user credentials

On successful login, there are several options under the admin tab as below.

To add a user, click on User Manager

Enter the details and click add. The added user will appear as below

With the added users, you can then proceed and set ACL under the “Access Control List Management

On the welcome page, create the first page by clicking on start as below.

Add the preferred content to the page.

The content can be saved, previewed as below.

At this point, it is safe to delete the install.php file.

sudo rm /var/www/wiki/install.php

7. Secure DokuWiki using Let’s Encrypt SSL Certificates

Now we want to secure the DokuWiki page to be accessible by HTTPS. Here, we will use Let’s Encrypt to issue trusted SSL certificates for the domain name. Before proceeding, ensure that you have an FQDN.

Install Certbot on your system.

sudo dnf install certbot python3-certbot-apache

Once installed issue certificates for the domain name as below.

sudo certbot --apache

Proceed as shown.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: wiki.domain.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Requesting a certificate for wiki.domain.com

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/wiki.domain.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/wiki.domain.com/privkey.pem
This certificate expires on 2022-06-02.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Successfully deployed certificate for wiki.domain.com to /etc/httpd/conf.d/dokuwiki-le-ssl.conf
Congratulations! You have successfully enabled HTTPS on https://wiki.domain.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
 * Donating to EFF:                    https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Now access the Dokuwiki page via HTTPS.

That is it!

I hope this guide on how to install DokuWiki on Rocky Linux 8 / AlmaLinux 8 With Let’s Encrypt SSL was of great value.

Interested in more?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK