MediaWiki is a powerful, open-source wiki software developed by the Wikimedia Foundation. It allows for the collaborative creation and management of knowledge bases and is widely used to power wikis like Wikipedia. MediaWiki is designed to handle large-scale content, offering flexibility, scalability, and multilingual support. Its versioning features enable users to track and restore changes, making it ideal for team collaboration and content-heavy projects.


Why MediaWiki is Useful:

  • Content Collaboration: Ideal for large teams and communities working together on documentation or shared knowledge projects.
  • Version Control: Tracks edits and revisions, making it easy to manage changes over time.
  • Customizable: MediaWiki supports a wide range of extensions, skins, and templates for enhanced functionality and design.
  • Scalable: It can handle everything from small wikis to large-scale sites like Wikipedia.
  • Multilingual Support: MediaWiki’s multilingual capabilities make it perfect for global projects.

Creating an Instance on Cloud.shape.host

Step 1: Access the Dashboard and Create

Log in to Cloud.shape.host, click Create, and select Instances.

Shape.host Resources dashboard with Create > Instance highlighted.

Step 2: Choose a Datacenter Location

Pick a location such as New York, London, or Frankfurt to ensure low latency for your target audience.

Shape.host instance form with the data center location selector highlighted.

Step 3: Select a Plan

Choose the appropriate plan (Standard, CPU-Optimized, or Memory-Optimized) based on your resource requirements.

Step 4: Choose an Operating System

Select Ubuntu 24.04 as your OS for MediaWiki installation.

Shape.host instance form with the operating system image selector highlighted.

Step 5: Configure and Launch

Configure Network Type and Authentication Method (SSH key or password), then click Create Instance.

Shape.host instance form with the Create Instance button highlighted.

Locate Your Instance’s IP Address

Shape.host Resources dashboard with the server IP address highlighted.

Accessing Your Instance

  • SSH (for Linux/macOS):
   ssh root@<your-instance-ip>

Replace <your-instance-ip> with your instance’s public IP.

  • PuTTY (for Windows):
    Download PuTTY, enter the instance’s public IP, and click Open.

Installing and Configuring MediaWiki

Follow these steps to install and configure MediaWiki:

Step 1: Update and Upgrade the System

apt update -y
apt upgrade -y
Terminal showing APT package management commands and output.

Step 2: Install Required Dependencies

apt install apache2 mariadb-server imagemagick libapache2-mod-php php php-common php-intl php-xml php-curl php-gd php-mbstring php-mysql php-apcu
Terminal showing APT package management commands and output.

Step 3: Check Apache and MariaDB Status

Ensure both Apache and MariaDB are enabled and running:

systemctl is-enabled apache2
systemctl status apache2
systemctl is-enabled mariadb
systemctl status mariadb
Terminal showing systemd service management commands or output.
Terminal showing systemd service management commands or output.

Step 4: Verify PHP Version

php -v
Terminal showing php commands or output during Verify PHP Version.

Step 5: Configure UFW Firewall

ufw allow "Apache Full"
ufw allow ssh
ufw enable
ufw status
Terminal showing firewall configuration commands and rules.

Step 6: Configure PHP Settings

Edit the PHP configuration file:

nano /etc/php/8.3/apache2/php.ini
Terminal showing nano commands or output during Configure PHP Settings.

Update the following:

date.timezone = Europe/Amsterdam
upload_max_filesize = 80M
memory_limit = 512M
max_execution_time = 360

Save and Exit:

  • Press CTRL + O to save, then Enter.
  • Press CTRL + X to exit Nano.

Step 7: Restart Apache

systemctl restart apache2
Terminal showing systemd service management commands or output.

Step 8: Configure MariaDB for MediaWiki

mariadb-secure-installation
Terminal showing MariaDB/MySQL database security configuration prompts.
Terminal showing mariadb commands or output during Configure MariaDB for MediaWiki.

After MariaDB is secured, log in to the MariaDB server with the following – Enter your root password when prompted.

mariadb -u root -p

Create the database and user:

CREATE DATABASE mediawikidb;
CREATE USER 'mediawiki'@'localhost' IDENTIFIED BY 'mediawikipassdb';
GRANT ALL PRIVILEGES ON mediawikidb.* TO 'mediawiki'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
SHOW GRANTS FOR 'mediawiki'@'localhost';
Terminal showing SQL database and user configuration commands.

Type quit to exit from the MariaDB server.

Step 9: Download and Install MediaWiki

cd /var/www/
curl -O https://releases.wikimedia.org/mediawiki/1.41/mediawiki-1.41.1.tar.gz
tar -xzvf mediawiki-1.41.1.tar.gz
mv mediawiki-1.41.1/ mediawiki/
Terminal showing cd commands or output during Download and Install MediaWiki.
Terminal showing tar commands or output during Download and Install MediaWiki.
Terminal showing file and directory setup commands.

Step 10: Set Permissions for MediaWiki Directory

chown -R www-data:www-data /var/www/mediawiki
chmod 755 /var/www/mediawiki
Terminal showing file ownership or permission commands.

Step 11: Configure Apache for MediaWiki

Enable Apache rewrite module:

sudo a2enmod rewrite
Terminal showing systemd service management commands or output.

Create the virtual host configuration file:

nano /etc/apache2/sites-available/mediawiki.conf
Terminal showing Apache site configuration commands for MediaWiki.

Add this configuration:

<VirtualHost *:80>
 ServerName your.domain.com
 ServerAdmin example@your.domain.com
 DocumentRoot /var/www/mediawiki
 ErrorLog /var/log/apache2/your.domain.local_error.log
 CustomLog /var/log/apache2/your.domain.local_access.log combined

 <Directory /var/www/mediawiki/>
 Options FollowSymlinks
 AllowOverride All
 Require all granted
 </Directory>
</VirtualHost>
Terminal showing web server configuration text.

Save and Exit:

  • Press CTRL + O to save, then Enter.
  • Press CTRL + X to exit Nano.

Step 12: Enable the Site and Restart Apache

a2ensite mediawiki.conf
apachectl configtest
systemctl restart apache2
Terminal showing an Apache configuration test.
Terminal showing systemd service management commands or output.

Step 13: Secure MediaWiki with SSL

Install Certbot and configure SSL:

apt install certbot python3-certbot-apache
certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email contact@shape.host -d tutorials.shape.host
Terminal showing APT package management commands and output.
Terminal showing Certbot certificate commands and messages.

Step 14: Complete Installation via Browser

Open your browser and navigate to:

http://your-domain.com

Follow the setup wizard to complete the installation.


Step 15: MediaWiki Installation Initialization

The MediaWiki installation has begun, but the LocalSettings.php file is not found, indicating the initial setup is incomplete. To proceed, click on the “complete the installation” link, which will guide you through the configuration process.

MediaWiki message that LocalSettings.php is missing, with a link to complete setup.

Step 16: Language Selection

The first step in the MediaWiki installation process is to select the language for your wiki. You can choose both the interface language (for users) and the language of the wiki content itself. After selecting your preferred language, click “Continue” to proceed.

MediaWiki installer language selection.

Step 17: Environment Check

In this step, MediaWiki performs several checks to ensure your server environment meets the necessary requirements for installation. Here, it verifies that PHP, ICU, ImageMagick, and other essential components are installed and properly configured. If all checks are successful, click “Continue” to proceed with the installation.

MediaWiki installer welcome, environment checks and license information.

Step 18: Database Configuration

In this step, you’ll configure the database for your MediaWiki installation. MediaWiki supports several database systems, such as MariaDB and MySQL. Enter the database host (e.g., localhost), database name, username, and password. Ensure that these settings match those of the database you previously set up. After filling in the details, click “Continue.”

MediaWiki installer database connection settings.

Step 19: Wiki Name and Administrator Account Setup

Here, you’ll name your wiki and configure the administrator account. The admin account will have full control over the wiki. Enter a username, password, and email address for the admin account, and click “Continue” to finalize this step.

MediaWiki installer wiki-name and administrator account settings.

Step 20: Skin Selection

MediaWiki offers different skins (themes) that change the appearance of your wiki. Here, you can select a default skin for your wiki from the available options, such as MinervaNeue, MonoBook, Timeless, or Vector. Once you’ve made your selection, click “Continue” to proceed.

MediaWiki installer skin selection options.

Step 21: Caching Configuration

In this step, you can configure object caching for your MediaWiki installation. Caching can significantly improve the performance of your wiki, especially for larger installations. For most setups, enabling “PHP object caching” is recommended. After selecting the caching option, click “Continue.”

MediaWiki installer object caching settings.

Step 22: Final Review and Installation Completion

After reviewing all settings and verifying that the environment checks have passed, MediaWiki is ready for installation. The installer summarizes the steps, and once everything is confirmed, click “Continue” to complete the installation. You will then be prompted to download the LocalSettings.php file and place it in the root of your MediaWiki directory.

MediaWiki installer welcome, environment checks and license information.

Now the file LocalSettings.php will be downloaded automatically to your local machine. Upload that file or create the LocalSettings.php file with the same content as you have.

MediaWiki setup completion page with the LocalSettings.php download.

To change the default skin to Minerva:

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

Change $wgDefaultSkin to minerva.

$wgDefaultSkin = “minerva”;

Update MediaWiki:

php maintenance/update.php

Step 23: Main Page of Your MediaWiki Installation

The installation is complete, and you are now directed to the main page of your new wiki. From here, you can start customizing your wiki, adding content, and configuring user permissions. The default MediaWiki tools and links to helpful resources are listed on this page.

MediaWiki main page after installation, with getting-started links.

Step 24: Admin Login

To access the admin dashboard and manage your new wiki, use the credentials you set during the installation process. Enter your username and password, and check the “Keep me logged in” option if you prefer staying logged in between sessions.

MediaWiki sign-in form.

For reliable and scalable hosting, consider using Shape.Host’s Linux SSD VPS services. Their high-performance infrastructure ensures your MediaWiki installation runs smoothly, even for large-scale wikis.