Post

MediaWiki Install - Ubuntu 22.04

MediaWiki is an open-source management software for content in the form of a wiki system that makes websites such as Wikipedia.org possible. MediaWiki helps you collect and organize knowledge and make it available to others.

Steps To Install MediaWiki

Update Ubuntu

1
2
sudo apt update && sudo apt upgrade
sudo apt install lsb-release ca-certificates apt-transport-https software-properties-common unzip -y

Install Apache

1
sudo apt install apache2

Enable and Check Status:

1
2
sudo systemctl enable --now apache2
systemctl status apache2

Install PHP and Required Extensions

For the latest version of PHP, add the Ondrej repository:

1
2
sudo add-apt-repository ppa:ondrej/php
sudo apt update

Install PHP:

1
sudo apt install imagemagick php php-{fpm,intl,xml,curl,gd,mbstring,mysql,apcu,zip}

To Configure php.ini:

1
sudo nano /etc/php/*/fpm/php.ini

Find and change the following values as shown below:

1
2
3
4
5
6
file_uploads = On
allow_url_fopen = On
upload_max_filesize = 64M
memory_limit = 256M
max_execution_time = 600
date.timezone = <your timezone>

Now, restart PHP-FPM:

1
sudo systemctl restart php*-fpm.service

Install MariaDB

Install MariaDB:

1
sudo apt install mariadb-server

Secure you database:

1
sudo mysql_secure_installation
1
2
3
4
5
6
7
8
Enter current password for root (enter for none): Press ENTER
Set root password? [Y/n]: Y
New password: Set-your-new-password
Re-enter new password: Set-your-new-password
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Enable and check status:

1
2
sudo systemctl enable --now mariadb
systemctl status mariadb

Create Database for MediaWiki

1
2
3
4
5
CREATE DATABASE wikidb;
CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON wikidb.* TO 'wikiuser'@'localhost' WITH GRANT OPTION;
flush privileges;
exit;

Download MediaWiki

Go to MediaWiki Download. Right click the Download link and Copy link address for the .zip file.

User wget to download MediaWiki (version may be different):

1
wget https://releases.wikimedia.org/mediawiki/1.39/mediawiki-1.39.0.zip

Unzip MediaWiki file:

1
unzip mediawiki-1.39.0.zip

Move the files to the Apache root folder:

1
sudo mv mediawiki*/* /var/www/html/

Change the ownership of the files to the proper user and group for Apache:

1
sudo chown -R www-data:www-data /var/www/html/

Start the MediaWiki Web Install

Open your local browser and gto to the IP address of your Ubuntu server:

1
http://ip.address

Follow the intructions for the setup.

This post is licensed under CC BY 4.0 by the author.