Yes, you can install MediaWiki on Ubuntu 22.04, but the version choice matters. Ubuntu 22.04 ships PHP 8.1 by default, while the current MediaWiki stable branch requires PHP 8.2 or newer. For a clean stock Ubuntu 22.04 LAMP stack, MediaWiki 1.43 LTS is the safer supported target.
This guide uses Apache, MariaDB, PHP 8.1, and MediaWiki 1.43.8 LTS. 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.43 LTS on stock Ubuntu 22.04 because it supports PHP 8.1.
- Use MediaWiki 1.45 stable only when you provide PHP 8.2 or newer.
- After installation, move
LocalSettings.phpinto the web root and back up the database plus theimages/directory.
Source check – May 10, 2026: The MediaWiki download page lists 1.45.3 as the current stable release and 1.43.8 as the current LTS release. The MediaWiki compatibility page says 1.45 requires PHP 8.2+, while the MediaWiki 1.43 release notes require PHP 8.1+ and MariaDB 10.3+ or MySQL 5.7+.
| Topic | When | Command or source |
|---|---|---|
| Ubuntu 22.04 default path | Stock PHP 8.1 | MediaWiki 1.43 LTS |
| Latest stable MediaWiki | PHP 8.2+ | MediaWiki download page |
| Post-install hardening | After the first login | MediaWiki 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.43 LTS on Ubuntu 22.04?
- MediaWiki 1.45.3 is the current stable release, but it requires PHP 8.2 or later.
- MediaWiki 1.43.8 is the current long-term support release and supports PHP 8.1.
- Ubuntu 22.04 defaults to PHP 8.1, so MediaWiki 1.43.8 is the least disruptive supported option.
If you specifically want MediaWiki 1.45.x, plan on a newer PHP stack or a newer Ubuntu base image. For a straightforward Ubuntu 22.04 deployment, 1.43 LTS is the safer route.
Prerequisites
- An Ubuntu 22.04 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
These packages cover the common MediaWiki requirements for Apache, MariaDB, and the PHP extensions needed for a functional install.
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.
Step 3: Download the supported MediaWiki release
Download the MediaWiki 1.43.8 LTS tarball from the official MediaWiki release archive and extract it under /var/www.
Step 4: Create an Apache virtual host for MediaWiki
Create a dedicated site definition instead of editing the default Apache site directly.
Enable the site and the rewrite module, then test Apache before restarting it.
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.
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.
On Ubuntu 22.04, you should expect PHP 8.1 unless you have deliberately upgraded the 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.


Leave a Reply