Jump to content

ICT:MW Installation procedure 1.43 LTS

From Costa Sano MediaWiki
Revision as of 13:31, 3 April 2026 by Mngr (talk | contribs)

Installation Procedure for newMW (MediaWiki 1.43 LTS)

This document describes the clean, reproducible installation workflow for deploying a new MediaWiki instance (newMW) on the existing 3‑VM infrastructure. It includes directory preparation, file extraction, permissions, database creation, and the preferred ownership model for VS Code access.

1. Create the newwiki Database (VM2 – Database Layer)

All commands in this section are executed on VM2.

1.1 Connect to MariaDB

mysql -u root -p

1.2 Create the database

CREATE DATABASE newwiki
  CHARACTER SET utf8mb4
  COLLATE utf8mb4_unicode_ci;

1.3 Create the database user

Replace VM1-IP with the internal Hyper‑V IP of the web server.

CREATE USER 'newwikiuser'@'VM1-IP' IDENTIFIED BY 'strongpassword';

1.4 Grant privileges

GRANT ALL PRIVILEGES ON newwiki.* TO 'newwikiuser'@'VM1-IP';
FLUSH PRIVILEGES;

1.5 Exit MariaDB

EXIT;

2. Prepare the Installation Directory (VM1 – Web Layer)

All commands below are executed on VM1.

2.1 Create the target directory

mkdir /var/www/newMW

2.2 Move into the working directory

cd /var/www

3. Download MediaWiki

Download the latest LTS tarball (example: 1.43.8):

wget https://releases.wikimedia.org/mediawiki/1.43/mediawiki-1.43.8.tar.gz

4. Extract MediaWiki

Extract the archive. This creates a directory such as mediawiki-1.43.8/.

tar -xvzf mediawiki-1.43.8.tar.gz

5. Move Extracted Files into newMW

Move normal files:

mv mediawiki-1.43.8/* newMW/

Move hidden files (e.g. .htaccess):

mv mediawiki-1.43.8/.* newMW/ 2>/dev/null

Remove the now‑empty extraction directory:

rmdir mediawiki-1.43.8

Remove the tarball:

rm mediawiki-1.43.8.tar.gz

6. Ownership and Permissions

Use the preferred ownership model to allow editing via VS Code while keeping Apache fully functional.

6.1 Set owner and group

chown -R mngr:apache /var/www/newMW

6.2 Ensure group write permissions

chmod -R g+w /var/www/newMW

6.3 Apply clean directory/file permissions

Directories:

find /var/www/newMW -type d -exec chmod 775 {} \;

Files:

find /var/www/newMW -type f -exec chmod 664 {} \;

6.4 Enable group inheritance (setgid)

Ensures new files created inside inherit the apache group.

chmod g+s /var/www/newMW

7. Apache Virtual Host (VM1)

Create a vhost:

<VirtualHost *:8080>
    ServerName newwiki.example.com
    DocumentRoot /var/www/newMW

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

    ErrorLog /var/log/httpd/newwiki-error.log
    CustomLog /var/log/httpd/newwiki-access.log combined
</VirtualHost>

Restart Apache:

systemctl restart httpd

8. nginx Reverse‑Proxy (VM3)

Add a server block:

server {
    listen 80;
    server_name newwiki.example.com;

    location / {
        proxy_pass http://VM1-IP:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Reload nginx:

systemctl reload nginx

9. Run the MediaWiki Installer

Navigate to:

https://newwiki.example.com

Provide:

  • Database: newwiki
  • User: newwikiuser
  • Password: (as created on VM2)
  • Site name
  • Admin account

Download LocalSettings.php and place it in:

/var/www/newMW/LocalSettings.php

10. Minimal Post‑Install Configuration

Add or verify:

$wgServer = "https://newwiki.example.com";
$wgScriptPath = "";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;

Enable uploads (optional):

$wgEnableUploads = true;

Enable SyntaxHighlight:

wfLoadExtension( 'SyntaxHighlight_GeSHi' );

11. Verification Checklist

  • Site loads correctly
  • /wiki/Main_Page resolves
  • Editing works
  • File uploads work (if enabled)
  • No rewrite errors in Apache logs
  • nginx proxies correctly
  • MariaDB connections succeed

12. Summary

This procedure provides a clean, repeatable installation workflow for MediaWiki 1.43 LTS using the preferred ownership model (mngr:apache) and the existing 3‑VM architecture. It ensures clarity, maintainability, and successor‑friendly operation.