Image

Knowledge base → Installing MediaWiki on Ubuntu 20.04 (LAMP)

[Virtual servers] [Applications on VPS/VDS]
Date of publication: 09.09.2022

Consider installing MediaWiki CMS on Ubuntu 20.04 with LAMP preinstalled. Similarly, you can add multiple sites to one server. The guide will also be relevant for transferring sites, for example, from shared hosting to a VPS server.

We make all settings from the root user, if you are using a regular user, add before the command sudo.

1. Download the latest version of mediawiki and install the necessary components 

apt update && sudo apt upgrade
wget https://releases.wikimedia.org/mediawiki/1.38/mediawiki-1.38.2.tar.gz
mkdir -p /var/www/
tar xvf mediawiki-1.38.2.tar.gz -C /var/www/
mv /var/www/mediawiki-1.38.2 /var/www/domain.tld
apt install php7.4-mbstring php7.4-xml php7.4-fpm php7.4-json php7.4-mysql php7.4-curl php7.4-intl php7.4-gd php7.4-mbstring texlive imagemagick
apt-get update
apt install composer
cd /var/www/domain.tld/
composer install --no-dev

2. Let's create a database

mariadb -u root

CREATE DATABASE mediawiki; GRANT ALL PRIVILEGES ON mediawiki.* TO 'user'@'localhost' IDENTIFIED BY 'your-password'; flush privileges; exit;

This data will need to be specified in the browser at the last stage of installation.

3. Web service setup

Assign rights and create a configuration file for our domain:

chown www-data:www-data /var/www/domain.tld/ -R
nano /etc/apache2/sites-available/mediawiki.conf

ServerName domain.tld ServerAdmin admin@domain.tld DocumentRoot /var/www/domain.tld/

Options FollowSymLinks AllowOverride All Order allow,deny allow from all

ErrorLog /var/log/apache2/domain.tld_error CustomLog /var/log/apache2/domain.tld_access common

apache2ctl configtest
a2ensite mediawiki.conf
systemctl reload apache2

Change domain.tld to your already configured in the DNS editor to the ip address of the VPS server. Thus, you can add several sites by analogy. Go to the browser using the configured http://domain.tld/ domain and complete the installation in the browser. You will be prompted to select a language, specify the administrator login and password, as well as the database settings created in step 2.

4. Installing the settings file

At the final stage of the installation, you will be asked to download the LocalSettings.php configuration file and place it in the root folder of this CMS.

nano LocalSettings.php

Copy the contents of the file and paste it into the console using the Shift + Insert keys. Next, save Ctrl + O, Enter. Use Ctrl+X to exit. Go to address http://domain.tld/.


Installation completed. In case of site transfer, you can place existing files and import the database.





No Comments Yet