Practical Linux, Windows Server and cloud guides for IT pros.

Install MediaWiki on Ubuntu 26.04 with 1.46.1

Install MediaWiki 1.46.1 on Ubuntu 26.04 with Apache, MariaDB and PHP 8.5. Follow the setup steps, verify the install and plan post-install hardening.

Filed under

Published

Written by

Last updated

MediaWiki installation guide header

Yes, you can install MediaWiki 1.46.1 on Ubuntu 26.04. Ubuntu 26.04 uses PHP 8.5 by default, and the MediaWiki 1.46 stable branch supports PHP 8.3 through 8.5, so the latest stable release works with Ubuntu’s standard PHP packages.

This guide uses Apache, MariaDB, PHP 8.5, and MediaWiki 1.46.1 stable. If MediaWiki is already installed and you want to tune Apache, uploads, clean URLs, and hardening, use the companion guide: How to Configure and Harden MediaWiki on Ubuntu After Installation.

TL;DR

  • Use MediaWiki 1.46.1 stable on Ubuntu 26.04 with its default PHP 8.5 packages.
  • MediaWiki 1.46 supports PHP 8.3 through 8.5; MediaWiki 1.43.10 remains the current LTS release.
  • After installation, move LocalSettings.php into the web root and back up the database plus the images/ directory.
TopicWhenCommand or source
Ubuntu 26.04 default pathStock PHP 8.5Ubuntu PHP package
Latest stable MediaWikiPHP 8.3–8.5MediaWiki 1.46.1 download
Post-install hardeningAfter the first loginMediaWiki hardening guide

Start here: If you are new to Linux web servers, review the Linux start-here guide and the PHP 8 install guide before changing a production host.

Why use MediaWiki 1.46.1 on Ubuntu 26.04?

  • MediaWiki 1.46.1 is the current stable release and supports PHP 8.3 through 8.5.
  • Ubuntu 26.04 provides PHP 8.5 by default, which is supported by MediaWiki 1.46.
  • MediaWiki 1.43.10 remains the current long-term support release if you need the LTS branch.

This guide follows the current stable release on Ubuntu’s default PHP 8.5 stack. If you require MediaWiki LTS, use version 1.43.10 and its matching release tarball instead.

Prerequisites

  • An Ubuntu 26.04 LTS server with sudo access.
  • A DNS name or server IP you can use during setup.
  • Apache, MariaDB, and PHP packages from the Ubuntu repositories.
  • Ports 80 and 443 open if the host is internet-facing.

Step 1: Update Ubuntu and install the LAMP dependencies

sudo apt update && sudo apt upgrade -y
sudo apt install -y apache2 mariadb-server libapache2-mod-php php php-mysql php-xml php-mbstring php-intl php-apcu php-curl php-zip imagemagick unzip

These packages cover the common MediaWiki requirements for Apache, MariaDB, and the PHP extensions needed for a functional install. On Ubuntu 26.04, the generic php and libapache2-mod-php package names install PHP 8.5.

Step 2: Secure MariaDB and create the MediaWiki database

Run the MariaDB hardening script first, then create a dedicated database and database user for MediaWiki.

sudo mysql_secure_installation
sudo mysql -u root -p
CREATE DATABASE mediawiki;
CREATE USER 'mediawikiuser'@'localhost' IDENTIFIED BY 'ReplaceThisWithAStrongPassword';
GRANT ALL PRIVILEGES ON mediawiki.* TO 'mediawikiuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 3: Download the supported MediaWiki release

Download the MediaWiki 1.46.1 stable tarball from the official MediaWiki release archive and extract it under /var/www.

cd /tmp
wget https://releases.wikimedia.org/mediawiki/1.46/mediawiki-1.46.1.tar.gz
sudo tar -xzf mediawiki-1.46.1.tar.gz -C /var/www/
sudo mv /var/www/mediawiki-1.46.1 /var/www/mediawiki
sudo chown -R www-data:www-data /var/www/mediawiki

Step 4: Create an Apache virtual host for MediaWiki

Create a dedicated site definition instead of editing the default Apache site directly.

sudo nano /etc/apache2/sites-available/mediawiki.conf
<VirtualHost *:80>
    ServerName wiki.example.com
    DocumentRoot /var/www/mediawiki

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

    ErrorLog ${APACHE_LOG_DIR}/mediawiki-error.log
    CustomLog ${APACHE_LOG_DIR}/mediawiki-access.log combined
</VirtualHost>

Enable the site and the rewrite module, then test Apache before restarting it.

sudo a2ensite mediawiki.conf
sudo a2enmod rewrite
sudo apache2ctl configtest
sudo systemctl reload apache2

Step 5: Complete the web installer

Open the site in your browser. If DNS is not ready yet, use the server IP. MediaWiki should redirect you to the installer.

During the web-based setup, choose MariaDB/MySQL as the database backend, use localhost for the database host, set the database name to mediawiki, and use the database user and password created earlier.

Step 6: Move LocalSettings.php into place

At the end of the installer, MediaWiki downloads a LocalSettings.php file. Move that file into the MediaWiki document root.

sudo mv ~/Downloads/LocalSettings.php /var/www/mediawiki/
sudo chown www-data:www-data /var/www/mediawiki/LocalSettings.php

After that file is in place, reload the site and confirm the wiki home page loads normally.

Step 7: Verify the install

Check that Apache is serving the site, MariaDB is running, and PHP is the version you expected.

sudo systemctl status apache2
sudo systemctl status mariadb
php -v

On Ubuntu 26.04, you should expect PHP 8.5 unless you have deliberately installed a different PHP runtime.

What to do after installation

  • Enable HTTPS with Let’s Encrypt or your preferred certificate workflow.
  • Set up clean URLs if you want friendlier page addresses.
  • Review file upload settings and permissions.
  • Back up both the database and the images/ directory.
  • Harden the Apache configuration and restrict access where needed.

That work now lives in the companion page: How to Configure and Harden MediaWiki on Ubuntu After Installation.

Related TurboGeek guides

Did this solve it?

One response to “Install MediaWiki on Ubuntu 26.04 with 1.46.1”

  1. esentia avatar

    Very helpful blog post on installing MediaWiki! The step-by-step instructions are clear and concise, making the installation process much easier. I appreciate the inclusion of tips and troubleshooting advice throughout the guide. This will be invaluable for anyone looking to set up their own MediaWiki site. Thank you for sharing.

Leave a Reply

Your email address will not be published. Required fields are marked *

Find more on the site

Keep reading by topic.

If this post was useful, the fastest way to keep going is to pick the topic you work in most often.

Want another useful post?

Browse the latest posts, or support TurboGeek if the site saves you time regularly.