Qu'est-ce que MediaWiki?
MediaWiki est une plateforme wiki gratuite et open source développée par la Wikimedia Foundation. It powers some of the world’s largest collaborative knowledge bases, y compris Wikipédia.
Les organisations utilisent fréquemment MediaWiki pour créer:
- Portails de documentation interne
- Bases de connaissances
- Sites de documentation technique
- Manuels des employés
- Plateformes de contenu communautaires
- Ressources pédagogiques
Its flexibility, extensive extension ecosystem, and active development community make it a popular choice for businesses, educational institutions, and technical teams.
Why Use AlmaLinux for MediaWiki?
AlmaLinux is a stable enterprise Linux distribution designed for production environments.
Benefits of deploying MediaWiki on AlmaLinux include:
- Accompagnement à long terme
- Enterprise-grade stability
- Mises à jour de sécurité
- Compatibility with common hébergement web stacks
- Strong community support
The combination of AlmaLinux, Apache, MariaDB, and PHP provides a reliable foundation for hosting MediaWiki.
Hébergement Web WordPress
À partir de €2.99/Mensuel
Conditions préalables
Before starting the installation, s'assurer que les exigences suivantes sont respectées:
Système opérateur
- AlmaLinux 8 ou plus tard
Access Requirements
- Root access or sudo privileges
- Connectivité Internet
- A public IP address or domain name
Required Components
MediaWiki requires:
- Serveur Web Apache
- MariaDB Database Server
- PHP and required extensions
Étape 1: Mettre à jour le système
Before installing any software, update all existing packages.
sudo dnf update -y
This ensures the operating system is running the latest available packages and security updates.
Étape 2: Install Apache and MariaDB
Install the web server and database server packages.
sudo dnf install httpd mariadb mariadb-server -y
Une fois installé, the services will be available for configuration.
Serveur VPS pas cher
À partir de €8/Mensuel
Étape 3: Install PHP 8.1 and Required Extensions
Modern MediaWiki releases work best with PHP 8.1 ou plus récent.
Install EPEL Repository
sudo dnf install epel-release -y
Install Remi Repository
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
Update repository information:
sudo dnf update -y
Reset Existing PHP Modules
sudo dnf module reset php -y
Enable PHP 8.1 Repository
sudo dnf module enable php:remi-8.1 -y
Installer PHP et les extensions requises
sudo dnf install php php-curl php-bcmath php-gd php-soap php-mbstring php-mysqlnd php-xml php-intl php-zip -y
Verify the installed PHP version:
php -v
Étape 4: Start and Enable Services
Start Apache and MariaDB and configure them to launch automatically during system boot.
sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl start mariadb
sudo systemctl enable mariadb
Vérifier l'état du service:
sudo systemctl status httpd
sudo systemctl status mariadb
Both services should report an active running status.
Hébergement VPS Windows
Accès à distance et administrateur complet
Étape 5: Secure MariaDB
Run the built-in MariaDB security script.
sudo mysql_secure_installation
The wizard will help you:
- Set a root password
- Supprimer les comptes anonymes
- Disable remote root login
- Supprimer les bases de données de test
- Improve overall database security
Follow the prompts according to your security requirements.
Étape 6: Create the MediaWiki Database
Connect to MariaDB:
sudo mysql -u root -p
Create a new database:
CREATE DATABASE mediawiki_db;
Create a dedicated database user:
CREATE USER 'mediawiki_user'@'localhost' IDENTIFIED BY 'StrongPasswordHere';
Accorder des autorisations:
GRANT ALL PRIVILEGES ON mediawiki_db.* TO 'mediawiki_user'@'localhost';
Apply the changes:
FLUSH PRIVILEGES;
Exit MariaDB:
EXIT;
Record the following information because it will be required later:
- Nom de la base de données
- Nom d'utilisateur de la base de données
- Mot de passe de la base de données
Étape 7: Download MediaWiki
Move to a temporary directory:
cd /tmp
Download the latest MediaWiki release.
Exemple:
wget https://releases.wikimedia.org/mediawiki/1.40/mediawiki-1.40.1.tar.gz
The version number may change over time as new releases become available.
Étape 8: Extract MediaWiki Files
Extract the archive into the web root directory:
sudo tar -xvzf mediawiki-1.40.1.tar.gz -C /var/www/html/
Create a simplified symbolic link:
sudo ln -s /var/www/html/mediawiki-1.40.1 /var/www/html/mediawiki
This allows easier future upgrades.
Étape 9: Configure File Ownership
Assign the correct ownership to Apache.
sudo chown -R apache:apache /var/www/html/mediawiki
Verify ownership:
ls -la /var/www/html/
Étape 10: Configure SELinux
Check the current SELinux mode:
getenforce
If SELinux is enabled, apply proper labels:
sudo restorecon -FR /var/www/html/mediawiki
This prevents permission-related issues when accessing MediaWiki through Apache.
Étape 11: Configure Firewall Rules
Autoriser le trafic HTTP et HTTPS.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
Reload the firewall:
sudo firewall-cmd --reload
Verify active rules:
sudo firewall-cmd --list-all
Étape 12: Launch the Web Installer
Open a browser and visit:
http://SERVER_IP/mediawiki/
Remplacer:
SERVER_IP
with your actual server IP address or domain name.
The MediaWiki installation wizard will appear.
Étape 13: Configure MediaWiki
The web installer will guide you through several configuration screens.
Select Languages
Choisir:
- Installation language
- Wiki content language
Cliquez Continue.
Environment Verification
MediaWiki will perform system checks to verify:
- Version PHP
- Extensions
- Autorisations
- Database connectivity
Resolve any warnings before continuing.
Connect to the Database
Entrer:
- Nom de la base de données
- Nom d'utilisateur de la base de données
- Mot de passe de la base de données
created earlier.
Passer à l'étape suivante.
Configure Database Access
Sélectionner:
Use the same account as for installation
unless you specifically require a separate database account.
Configure Wiki Information
Entrer:
- Wiki name
- Administrator username
- Administrator password
- Contact information if required
Additional Options
Configure optional settings such as:
- Email support
- Autorisations utilisateur
- Logo customization
- Caching preferences
Continue until the installation process begins.
Étape 14: Complete Installation
MediaWiki will create the required database tables and finalize the configuration.
Une fois l'installation terminée, a file named:
LocalSettings.php
will be generated.
Download this file and upload it to:
/var/www/html/mediawiki/
Without this file, MediaWiki cannot operate correctly.
Étape 15: Access the Wiki
Visite:
http://SERVER_IP/mediawiki/
Cliquez:
Log In
and authenticate using the administrator account created during installation.
You should now have full administrative access to your MediaWiki instance.
Managing Your MediaWiki Installation
Après le déploiement, consider performing the following tasks:
- Configure HTTPS using SSL certificates
- Enable automatic backups
- Install useful MediaWiki extensions
- Configure caching
- Restrict registration if necessary
- Create user groups and permissions
- Surveiller les ressources du serveur
These improvements can enhance both security and performance.
How to Uninstall MediaWiki
If MediaWiki is no longer required, it can be removed from the server.
Stop Apache
sudo systemctl stop httpd
sudo systemctl disable httpd
Remove MediaWiki Files
sudo rm -rf /var/www/html/mediawiki
Remove any version-specific directories as needed.
Remove the Database
Connect to MariaDB:
mysql -u root -p
Delete the database:
DROP DATABASE mediawiki_db;
Delete the user account:
DROP USER 'mediawiki_user'@'localhost';
Apply changes:
FLUSH PRIVILEGES;
Sortie:
EXIT;
Remove Optional Packages
If the server will no longer host MediaWiki or other websites, you may remove Apache, MariaDB, and related packages.
sudo dnf remove httpd mariadb mariadb-server
Carefully verify dependencies before removing packages on production servers.
Finalizing Your MediaWiki Deployment
MediaWiki provides a powerful platform for creating collaborative documentation systems, internal knowledge bases, and public wiki websites. When deployed on AlmaLinux with Apache, MariaDB, et PHP, it offers a stable and scalable environment suitable for both small teams and large organizations.
By following proper security practices, maintaining regular backups, and keeping both MediaWiki and the operating system updated, you can build a reliable knowledge-sharing platform that grows alongside your organization.
