How to Install MediaWiki on RockyLinux 8

MediaWiki is the free open-source wiki software used to power Wikipedia and thousands of other wikis. The contributions of hundreds of individual developers have helped make it a feature-rich, secure and scalable platform capable of powering some of the largest collaboratively edited reference projects in the world.

Pre-requisites

  • A system with RockyLinux 8 installed and running.
  • root access to the system.
  • LAMP Stack installed and running, for this, you can refer to one of our guides on installing the LAMP Stack (Apache, MariaDB, and PHP).

Once you're all set, we'll proceed with Mediawiki installation and configuration

Update the System

dnf update 

Configure MySQL

Create the MySQL user, database using below command,

mysql -u root -p

CREATE DATABASE my_wiki;

GRANT ALL PRIVILEGES ON my_wiki.* TO 'mysql_user'@'localhost' IDENTIFIED BY 'StrongPassword' WITH GRANT OPTION;

FLUSH PRIVILEGES;

exit

Replace the StrongPassword with an actual password

Download the MediaWiki

Click Here to download the latest version of MediaWiki file,

dnf install wget

wget https://releases.wikimedia.org/mediawiki/1.39/mediawiki-1.39.3.tar.gz

Extract the file using below command,

dnf install tar 

tar -zxvf mediawiki-1.39.3.tar.gz

Move mediawiki-1.39.3 to apache document root directory /var/www/html

mv mediawiki-1.39.3 /var/www/html/mediawiki

Configure Apache Web Server for Mediawiki

Configure Mediawiki VirtualHost file /etc/httpd/conf.d/dev.domainhere.info.conf

vi /etc/httpd/conf.d/dev.domainhere.info.conf

Copy the below content and save it into the file.

Replace dev.domainhere.info with your actual domain name.

<VirtualHost *:80>

    ServerName dev.domainhere.info
    ServerAlias dev.domainhere.info
    ServerAdmin admin@dev.domainhere.info
    DocumentRoot /var/www/html/mediawiki

    ErrorLog /var/log/httpd/dev.domainhere.info_error.log
    CustomLog /var/log/httpd/dev.domainhere.info_access.log combined

    <Directory /var/www/html/mediawiki/>
        Options FollowSymlinks
        AllowOverride All
        Require all granted
    </Directory>

</VirtualHost>

Restart Apache web server using below command,

systemctl restart httpd

Set the required permissions on mediawiki directory

Change the ownership and grou of mediawiki directory using below command,

chown -R apache:apache /var/www/html/mediawiki/

If SELinux is enabled then apply below selinux rule on mediawiki folder,

getenforce

Output:

Enforcing

Set the rule using below command,

restorecon -FR /var/www/html/mediawiki/

Configure MediaWiki

Navigate your browser to http://dev.domainhere.info

Replace dev.domainhere.info with your actual domain name

images

Select your language and click on continue,

images

Click on Continue to complete installation,

images

Fill the Database user, name details and click on continue,

images

If you want to use the same account then mark tick the box and click on continue,

images

Fill your wiki name , your user name, password, email address, and click on continue,

images

Click on Continue to install MediaWiki,

images

images

Next, MediaWiki will provide the settings that was configured so far in the form of a php file. The file with settings should be placed into the web root directory, /var/www/html/meddiawiki/.
Click on the Download LocalSettings.php link, a file will be downloaded to your local system.

Open it with a notepad or similar application.

Copy the contents of the file and Switch over to the server, paste the contents into the file mentioned below:

  nano /var/www/html/mediawiki/LocalSettings.php

After pasting the contents to the file, save and exit.

images

Restart the Apache using below command,

Once downloaded Click on Enter Wiki and you will get the MediaWiki Dashboard Page,

images

That's how we installed the MediaWiki on RockyLinux 8 OS.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS