Jump to content

ICT:MW Installation procedure 1.43 LTS: Difference between revisions

From Costa Sano MediaWiki
Created page with "= 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, and the preferred ownership model for VS Code access. == 1. Preparation == All commands are executed on VM1 (Web Layer). === 1.1 Create the target directory === <pre> mkdir /var/www/newMW </pre>..."
 
No edit summary
Line 2: Line 2:
This document describes the clean, reproducible installation workflow for
This document describes the clean, reproducible installation workflow for
deploying a new MediaWiki instance (newMW) on the existing 3‑VM infrastructure.
deploying a new MediaWiki instance (newMW) on the existing 3‑VM infrastructure.
It includes directory preparation, file extraction, permissions, and the
It includes directory preparation, file extraction, permissions, database
preferred ownership model for VS Code access.
creation, and the preferred ownership model for VS Code access.


== 1. Preparation ==
== 1. Create the newwiki Database (VM2 – Database Layer) ==
All commands are executed on VM1 (Web Layer).
All commands in this section are executed on VM2.


=== 1.1 Create the target directory ===
=== 1.1 Connect to MariaDB ===
<pre>
mysql -u root -p
</pre>
 
=== 1.2 Create the database ===
<pre>
CREATE DATABASE newwiki
  CHARACTER SET utf8mb4
  COLLATE utf8mb4_unicode_ci;
</pre>
 
=== 1.3 Create the database user ===
Replace <code>VM1-IP</code> with the internal Hyper‑V IP of the web server.
 
<pre>
CREATE USER 'newwikiuser'@'VM1-IP' IDENTIFIED BY 'strongpassword';
</pre>
 
=== 1.4 Grant privileges ===
<pre>
GRANT ALL PRIVILEGES ON newwiki.* TO 'newwikiuser'@'VM1-IP';
FLUSH PRIVILEGES;
</pre>
 
=== 1.5 Exit MariaDB ===
<pre>
EXIT;
</pre>
 
== 2. Prepare the Installation Directory (VM1 – Web Layer) ==
All commands below are executed on VM1.
 
=== 2.1 Create the target directory ===
<pre>
<pre>
mkdir /var/www/newMW
mkdir /var/www/newMW
</pre>
</pre>


=== 1.2 Move into the working directory ===
=== 2.2 Move into the working directory ===
<pre>
<pre>
cd /var/www
cd /var/www
</pre>
</pre>


== 2. Download MediaWiki ==
== 3. Download MediaWiki ==
Download the latest LTS tarball (example: 1.43.8):
Download the latest LTS tarball (example: 1.43.8):


Line 25: Line 58:
</pre>
</pre>


== 3. Extract MediaWiki ==
== 4. Extract MediaWiki ==
Extract the archive. This creates a directory such as <code>mediawiki-1.43.8/</code>.
Extract the archive. This creates a directory such as <code>mediawiki-1.43.8/</code>.


Line 32: Line 65:
</pre>
</pre>


== 4. Move Extracted Files into newMW ==
== 5. Move Extracted Files into newMW ==
Move normal files:
Move normal files:


Line 57: Line 90:
</pre>
</pre>


== 5. Ownership and Permissions ==
== 6. Ownership and Permissions ==
Use the preferred ownership model to allow editing via VS Code while keeping
Use the preferred ownership model to allow editing via VS Code while keeping
Apache fully functional.
Apache fully functional.


=== 5.1 Set owner and group ===
=== 6.1 Set owner and group ===
<pre>
<pre>
chown -R mngr:apache /var/www/newMW
chown -R mngr:apache /var/www/newMW
</pre>
</pre>


=== 5.2 Ensure group write permissions ===
=== 6.2 Ensure group write permissions ===
<pre>
<pre>
chmod -R g+w /var/www/newMW
chmod -R g+w /var/www/newMW
</pre>
</pre>


=== 5.3 Apply clean directory/file permissions ===
=== 6.3 Apply clean directory/file permissions ===
Directories:
Directories:


Line 84: Line 117:
</pre>
</pre>


=== 5.4 Enable group inheritance (setgid) ===
=== 6.4 Enable group inheritance (setgid) ===
Ensures new files created inside inherit the <code>apache</code> group.
Ensures new files created inside inherit the <code>apache</code> group.


Line 91: Line 124:
</pre>
</pre>


== 6. Apache Virtual Host ==
== 7. Apache Virtual Host (VM1) ==
Create a vhost on VM1:
Create a vhost:


<pre>
<pre>
Line 115: Line 148:
</pre>
</pre>


== 7. nginx Reverse‑Proxy (VM3) ==
== 8. nginx Reverse‑Proxy (VM3) ==
Add a server block:
Add a server block:


Line 137: Line 170:
</pre>
</pre>


== 8. Run the MediaWiki Installer ==
== 9. Run the MediaWiki Installer ==
Navigate to:
Navigate to:


Line 157: Line 190:
</pre>
</pre>


== 9. Minimal Post‑Install Configuration ==
== 10. Minimal Post‑Install Configuration ==
Add or verify:
Add or verify:


Line 179: Line 212:
</pre>
</pre>


== 10. Verification Checklist ==
== 11. Verification Checklist ==
* Site loads correctly
* Site loads correctly
* <code>/wiki/Main_Page</code> resolves
* <code>/wiki/Main_Page</code> resolves
Line 188: Line 221:
* MariaDB connections succeed
* MariaDB connections succeed


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

Revision as of 13:31, 3 April 2026

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.