Language & currency
Currency

Kostenlose Website & Server Migration

Colonel Server
MediaWiki Setup - Build a Wiki on Linux

Was ist MediaWiki??

MediaWiki ist eine kostenlose und quelloffene Wiki-Plattform, die von der Wikimedia Foundation entwickelt wurde. It powers some of the world’s largest collaborative knowledge bases, einschließlich Wikipedia.

Organisationen verwenden häufig MediaWiki zum Erstellen:

  • Interne Dokumentationsportale
  • Wissensdatenbanken
  • Websites zur technischen Dokumentation
  • Mitarbeiterhandbücher
  • Community-gesteuerte Content-Plattformen
  • Bildungsressourcen

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:

  • Long-term support
  • Enterprise-grade stability
  • Sicherheitsupdates
  • Compatibility with common Webhosting stacks
  • Strong community support

The combination of AlmaLinux, Apache, MariaDB, and PHP provides a reliable foundation for hosting MediaWiki.

Wordpress Hosting

WordPress-Webhosting

Beginnend mit €2.99/Monatlich

Jetzt kaufen

Voraussetzungen

Before starting the installation, Stellen Sie sicher, dass die folgenden Anforderungen erfüllt sind:

Betriebssystem

  • AlmaLinux 8 oder später

Zugangsvoraussetzungen

  • Root-Zugriff oder Sudo-Berechtigungen
  • Internet-Konnektivität
  • A public IP address or domain name

Erforderliche Komponenten

MediaWiki requires:

  • Apache Web Server
  • MariaDB Database Server
  • PHP and required extensions

Schritt 1: Aktualisieren Sie das System

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.

Schritt 2: Install Apache and MariaDB

Install the web server and database server packages.

sudo dnf install httpd mariadb mariadb-server -y

Einmal installiert, the services will be available for configuration.

Cheap VPS

Günstiger VPS-Server

Beginnend mit €8/Monatlich

Jetzt kaufen

Schritt 3: Install PHP 8.1 and Required Extensions

Modern MediaWiki releases work best with PHP 8.1 oder neuer.

Installieren Sie das 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

Installieren Sie PHP und erforderliche Erweiterungen

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

Schritt 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

Überprüfen Sie den Servicestatus:

sudo systemctl status httpd
sudo systemctl status mariadb

Both services should report an active running status.

Windows VPS

Windows VPS-Hosting

Fernzugriff und vollständige Verwaltung

Jetzt kaufen

Schritt 5: Secure MariaDB

Run the built-in MariaDB security script.

sudo mysql_secure_installation

The wizard will help you:

  • Set a root password
  • Entfernen Sie anonyme Konten
  • Disable remote root login
  • Testdatenbanken entfernen
  • Improve overall database security

Follow the prompts according to your security requirements.

Schritt 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';

Grant permissions:

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:

  • Datenbankname
  • Datenbankbenutzername
  • Datenbankpasswort

Schritt 7: Download MediaWiki

Move to a temporary directory:

cd /tmp

Download the latest MediaWiki release.

Beispiel:

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.

Schritt 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.

Schritt 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/

Schritt 10: Konfigurieren Sie SELinux

Check the current SELinux mode:

getenforce

Wenn SELinux aktiviert ist, apply proper labels:

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

This prevents permission-related issues when accessing MediaWiki through Apache.

Schritt 11: Configure Firewall Rules

HTTP- und HTTPS-Verkehr zulassen.

sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https

Laden Sie die Firewall neu:

sudo firewall-cmd --reload

Verify active rules:

sudo firewall-cmd --list-all

Schritt 12: Launch the Web Installer

Open a browser and visit:

http://SERVER_IP/mediawiki/

Ersetzen:

SERVER_IP

with your actual server IP address or domain name.

The MediaWiki installation wizard will appear.

Schritt 13: Configure MediaWiki

The web installer will guide you through several configuration screens.

Select Languages

Wählen:

  • Installation language
  • Wiki content language

Klicken Weitermachen.

Environment Verification

MediaWiki will perform system checks to verify:

  • PHP version
  • Extensions
  • Berechtigungen
  • Database connectivity

Resolve any warnings before continuing.

Connect to the Database

Eingeben:

  • Datenbankname
  • Datenbankbenutzername
  • Datenbankpasswort

created earlier.

Continue to the next step.

Configure Database Access

Wählen:

Use the same account as for installation

unless you specifically require a separate database account.

Configure Wiki Information

Eingeben:

  • Wiki name
  • Administrator username
  • Administrator password
  • Contact information if required

Additional Options

Configure optional settings such as:

  • Email support
  • Benutzerberechtigungen
  • Logo customization
  • Caching preferences

Continue until the installation process begins.

Schritt 14: Complete Installation

MediaWiki will create the required database tables and finalize the configuration.

Nach Abschluss der Installation, 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.

Schritt 15: Access the Wiki

Besuchen:

http://SERVER_IP/mediawiki/

Klicken:

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

Nach der Bereitstellung, 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
  • Überwachen Sie Serverressourcen

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';

Änderungen übernehmen:

FLUSH PRIVILEGES;

Exit:

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, und 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.

Teilen Sie diesen Beitrag

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert