ICT:MW Installation procedure 1.43 LTS: Difference between revisions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
= Installation Procedure for newMW (MediaWiki 1.43 LTS) = | = Installation Procedure for newMW (MediaWiki 1.43 LTS) = | ||
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. | ||
The installation is intentionally split into two phases: | |||
* Phase 1: Local installation and testing on VM1 (no reverse‑proxy required) | |||
* Phase 2: Public exposure through VM3 (nginx reverse‑proxy) | |||
This staged approach allows safe testing before the wiki becomes accessible | |||
from the internet. | |||
== 1. Create the newwiki Database (VM2 – Database Layer) == | == 1. Create the newwiki Database (VM2 – Database Layer) == | ||
| Line 124: | Line 130: | ||
</pre> | </pre> | ||
== 7. Apache Virtual Host (VM1) == | == 7. Local‑Only Apache Virtual Host (VM1) == | ||
This vhost allows installation and testing without involving the reverse‑proxy. | |||
<pre> | <pre> | ||
<VirtualHost *:8080> | <VirtualHost *:8080> | ||
ServerName | ServerName newmw.local | ||
DocumentRoot /var/www/newMW | DocumentRoot /var/www/newMW | ||
| Line 137: | Line 143: | ||
</Directory> | </Directory> | ||
ErrorLog /var/log/httpd/ | ErrorLog /var/log/httpd/newmw-local-error.log | ||
CustomLog /var/log/httpd/ | CustomLog /var/log/httpd/newmw-local-access.log combined | ||
</VirtualHost> | </VirtualHost> | ||
</pre> | </pre> | ||
| Line 148: | Line 154: | ||
</pre> | </pre> | ||
== 8. | == 8. Run the Installer Locally == | ||
Access the installer using one of: | |||
* <code>http://VM1-IP:8080</code> | |||
* <code>http://newmw.local:8080</code> (if added to /etc/hosts) | |||
Complete the installation. | |||
The installer will generate a <code>LocalSettings.php</code> with: | |||
<pre> | |||
$wgServer = "http://VM1-IP:8080"; | |||
</pre> | |||
Place the file in: | |||
<pre> | |||
/var/www/newMW/LocalSettings.php | |||
</pre> | |||
== 9. Local Testing == | |||
Before exposing the wiki publicly, verify: | |||
* Page creation | |||
* Editing | |||
* File uploads (if enabled) | |||
* User accounts | |||
* Extensions | |||
* Permissions | |||
* Logging | |||
This phase is isolated and safe. | |||
== 10. Prepare for Public Access (VM3 – Reverse‑Proxy Layer) == | |||
Only after local testing is complete, add the nginx server block: | |||
<pre> | <pre> | ||
| Line 170: | Line 209: | ||
</pre> | </pre> | ||
== | == 11. Update LocalSettings.php for Public Access == | ||
Change: | |||
<pre> | <pre> | ||
$wgServer = "https://newwiki.example.com"; | $wgServer = "https://newwiki.example.com"; | ||
</pre> | </pre> | ||
Optionally: | |||
<pre> | <pre> | ||
$wgCanonicalServer = "https://newwiki.example.com"; | |||
</pre> | </pre> | ||
== | == 12. Final Verification == | ||
* | * Public URL loads correctly | ||
* <code>/wiki/Main_Page</code> resolves | * <code>/wiki/Main_Page</code> resolves | ||
* Editing works | * Editing works | ||
* | * Uploads work | ||
* No rewrite errors in Apache logs | * No rewrite errors in Apache logs | ||
* nginx proxies correctly | * nginx proxies correctly | ||
* MariaDB connections succeed | * MariaDB connections succeed | ||
== | == 13. Summary == | ||
This procedure | This procedure installs MediaWiki in two safe phases: | ||
1 | |||
* Phase 1: Local installation and validation on VM1 | |||
* Phase 2: Public exposure through VM3 | |||
This staged approach avoids dependency on the reverse‑proxy during installation | |||
and allows controlled, low‑risk rollout. | |||
Revision as of 13:36, 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. The installation is intentionally split into two phases:
- Phase 1: Local installation and testing on VM1 (no reverse‑proxy required)
- Phase 2: Public exposure through VM3 (nginx reverse‑proxy)
This staged approach allows safe testing before the wiki becomes accessible from the internet.
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. Local‑Only Apache Virtual Host (VM1)
This vhost allows installation and testing without involving the reverse‑proxy.
<VirtualHost *:8080>
ServerName newmw.local
DocumentRoot /var/www/newMW
<Directory /var/www/newMW>
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/newmw-local-error.log
CustomLog /var/log/httpd/newmw-local-access.log combined
</VirtualHost>
Restart Apache:
systemctl restart httpd
8. Run the Installer Locally
Access the installer using one of:
http://VM1-IP:8080http://newmw.local:8080(if added to /etc/hosts)
Complete the installation.
The installer will generate a LocalSettings.php with:
$wgServer = "http://VM1-IP:8080";
Place the file in:
/var/www/newMW/LocalSettings.php
9. Local Testing
Before exposing the wiki publicly, verify:
- Page creation
- Editing
- File uploads (if enabled)
- User accounts
- Extensions
- Permissions
- Logging
This phase is isolated and safe.
10. Prepare for Public Access (VM3 – Reverse‑Proxy Layer)
Only after local testing is complete, add the nginx 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
11. Update LocalSettings.php for Public Access
Change:
$wgServer = "https://newwiki.example.com";
Optionally:
$wgCanonicalServer = "https://newwiki.example.com";
12. Final Verification
- Public URL loads correctly
/wiki/Main_Pageresolves- Editing works
- Uploads work
- No rewrite errors in Apache logs
- nginx proxies correctly
- MariaDB connections succeed
13. Summary
This procedure installs MediaWiki in two safe phases:
- Phase 1: Local installation and validation on VM1
- Phase 2: Public exposure through VM3
This staged approach avoids dependency on the reverse‑proxy during installation and allows controlled, low‑risk rollout.