How to Install MediaWiki on AlmaLinux 10

MediaWiki is the open-source wiki software that powers Wikipedia and many other collaborative websites. In this guide, you'll learn how to install and configure MediaWiki on AlmaLinux 10.

Pre-requisites

  • A system with AlmaLinux 10 installed.
  • Root or sudo access.
  • A domain name pointed to your server (for production use).

Update the System

dnf update -y

Install Required Packages

MediaWiki requires a web server, PHP (8.x+), and MariaDB.

Install Apache, PHP, and MariaDB:

dnf install -y epel-release
dnf install -y httpd mariadb-server wget tar policycoreutils-python-utils

Enable and install PHP 8.3 (latest from AppStream or Remi repo if required):

dnf module reset php -y
dnf module enable php:8.3 -y
dnf install -y php php-mysqlnd php-gd php-xml php-intl php-mbstring php-json php-cli php-opcache

Start and Enable Services

systemctl enable --now httpd mariadb

Configure the Firewall

systemctl enable --now firewalld
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload

Secure and Configure MariaDB

mysql_secure_installation

Then log in to MariaDB and create a database and user:

mysql -u root -p

CREATE DATABASE mediawiki_db;
GRANT ALL PRIVILEGES ON mediawiki_db.* TO 'wiki_user'@'localhost' IDENTIFIED BY 'StrongPassword';
FLUSH PRIVILEGES;
EXIT;

Replace 'StrongPassword' with a strong password.

Download and Extract MediaWiki

Visit MediaWiki Download Page or run:

wget https://releases.wikimedia.org/mediawiki/1.39/mediawiki-1.39.3.tar.gz
tar -zxvf mediawiki-1.39.3.tar.gz
mv mediawiki-1.39.3 /var/www/html/mediawiki

Set Ownership and SELinux Permissions

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

If SELinux is not enforcing, getenforce will show Permissive or Disabled.

Configure Apache for MediaWiki

Create a virtual host config file:

dnf install nano -y
nano /etc/httpd/conf.d/wiki.yourdomain.com.conf

Paste the following, replacing wiki.yourdomain.com:

<VirtualHost *:80>
     ServerName wiki.yourdomain.com
     ServerAlias www.wiki.yourdomain.com
     ServerAdmin admin@yourdomain.com
     DocumentRoot /var/www/html/mediawiki/

     <Directory /var/www/html/mediawiki>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
            RewriteEngine on
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    </Directory>
</VirtualHost>

Then restart Apache:

systemctl restart httpd

Complete MediaWiki Installation via Browser

Visit: http://wiki.yourdomain.com If you installed MediaWiki in a subdirectory like /mediawiki, then visit: http://yourdomain/mediawiki

images

  1. Choose your language → Continue

images

images

  1. Database configuration:
    • DB name: mediawiki_db
    • DB user: wiki_user
    • Password: StrongPassword images

images

  1. Site configuration:
    • Set site name, admin user, password, email

images

images

images

  1. Download the LocalSettings.php file when prompted.

images


Deploy LocalSettings.php

Move the file to your server:

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

Paste the contents of the file and save it.

Then restart Apache:

systemctl restart httpd

Access the MediaWiki

Now click "Enter your wiki" or revisit: images

http://wiki.yourdomain.com

images

You should see the MediaWiki dashboard.


You’ve successfully installed MediaWiki on AlmaLinux 10.


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