How to Install MediaWiki on Your Breeze
MediaWiki is the open-source wiki software that powers Wikipedia and thousands of other knowledge bases worldwide. It is designed for collaborative editing and is excellent for internal documentation, company wikis, community knowledge bases, and technical documentation. This guide walks you through installing MediaWiki on your Breeze instance.
Prerequisites
- A Breeze instance with Ubuntu 22.04 or later
- Apache or Nginx web server
- PHP 8.1+ with required extensions
- MySQL 5.7+ or MariaDB 10.4+ (or PostgreSQL/SQLite)
- At least 1 GB RAM
Step 1 — Install PHP Extensions
sudo apt update
sudo apt install -y php-mysql php-xml php-mbstring php-intl php-gd php-curl \
php-json php-apcu php-opcache
Step 2 — Create the Database
sudo mysql -u root -p
CREATE DATABASE mediawiki_db;
CREATE USER 'wiki_user'@'localhost' IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON mediawiki_db.* TO 'wiki_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 3 — Download and Extract MediaWiki
cd /tmp
wget https://releases.wikimedia.org/mediawiki/1.42/mediawiki-1.42.0.tar.gz
tar -xzf mediawiki-1.42.0.tar.gz
sudo mv mediawiki-1.42.0 /var/www/mediawiki
sudo chown -R www-data:www-data /var/www/mediawiki
Step 4 — Configure Apache
sudo nano /etc/apache2/sites-available/mediawiki.conf
<VirtualHost *:80>
ServerName wiki.yourdomain.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>
sudo a2ensite mediawiki.conf
sudo a2enmod rewrite
sudo systemctl reload apache2
Step 5 — Run the Web Installer
Navigate to http://wiki.yourdomain.com in your browser. The MediaWiki installer will guide you through:
- Language selection for the wiki interface
- Database configuration with the credentials from Step 2
- Wiki name and admin account creation
- Optional settings like email, uploads, and skins
At the end of the installation, MediaWiki generates a LocalSettings.php file. Download it and place it in the MediaWiki root:
sudo mv ~/Downloads/LocalSettings.php /var/www/mediawiki/
sudo chown www-data:www-data /var/www/mediawiki/LocalSettings.php
Step 6 — Enable Short URLs
For clean URLs like /wiki/Page_Name instead of /index.php?title=Page_Name, add to LocalSettings.php:
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;
Add an Apache rewrite rule in .htaccess:
RewriteEngine On
RewriteRule ^wiki/(.*)$ /index.php?title=$1 [QSA,L]
Recommended Extensions
- VisualEditor — WYSIWYG editing for non-technical users
- Cite — reference and citation management
- ParserFunctions — conditional logic in wiki templates
- ConfirmEdit — CAPTCHA to prevent spam
- MultimediaViewer — lightbox-style image viewing
Maintenance
Run maintenance scripts periodically to keep your wiki healthy:
cd /var/www/mediawiki/maintenance
php update.php # Apply database schema updates
php rebuildall.php # Rebuild search index and link tables
php runJobs.php # Process the job queue