Mediawiki Setting Up Guide: Difference between revisions
Created page with "<strong>MediaWiki Docker Setup Guide</strong> This guide walks you through setting up MediaWiki using Docker and Dockhand. Follow the steps below carefully, as some paths are required for extensions and configuration to work correctly. == Getting Started == Before proceeding, make sure you have access to a Linux server or local machine with sudo privileges. == Installation Steps == === 1. Install Docker and Docker Compose === Ensure that Docker and Docker Compose are..." |
BabiSender (talk | contribs) No edit summary |
||
| (10 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
== MediaWiki Docker Setup Guide == | |||
This guide walks you through setting up MediaWiki using Docker and Dockhand. Follow the steps | <div style="font-size: 100%;"> | ||
'''''This guide walks you through setting up MediaWiki using Docker and Dockhand. Follow the steps carefully, as specific paths are required for extensions and configuration to work correctly.''''' | |||
== Getting Started == | == Getting Started == | ||
| Line 8: | Line 9: | ||
== Installation Steps == | == Installation Steps == | ||
'''1. Install Docker and Docker Compose''' | |||
Ensure that Docker and Docker Compose are installed on your system. These tools are required to run MediaWiki and its supporting services in containers. | Ensure that Docker and Docker Compose are installed on your system. These tools are required to run MediaWiki and its supporting services in containers. | ||
'''2. Set Up Dockhand''' | |||
Dockhand provides a simple web interface for managing Docker stacks. | |||
Dockhand provides a simple web-based interface for managing Docker stacks. | |||
Run the following command in your terminal: | ''Run the following command in your terminal:'' | ||
< | <syntaxhighlight lang="bash" style="font-size: 85%;"> | ||
# Use matching paths with DATA_DIR | |||
docker run -d \ | |||
--name dockhand \ | |||
-p 3000:3000 \ | |||
-v /var/run/docker.sock:/var/run/docker.sock \ | |||
-v /opt/dockhand:/opt/dockhand \ | |||
-e DATA_DIR=/opt/dockhand \ | |||
fnsys/dockhand:latest | |||
</syntaxhighlight> | |||
Once the container is running, open your browser and go to: | Once the container is running, open your browser and go to: | ||
< | <syntaxhighlight lang="text" style="font-size: 85%;"> | ||
http://localhost:3000 | |||
</syntaxhighlight> | |||
You should now see the Dockhand web interface. | You should now see the Dockhand web interface. | ||
'''3. Create the MediaWiki Stack Directory''' | |||
Next, create a dedicated directory on the Docker host for your MediaWiki stack. | Next, create a dedicated directory on the Docker host for your MediaWiki stack. | ||
This location is important because it will store your configuration files and extensions. | This location is important because it will store your configuration files and extensions. | ||
Run the following commands: | Run the following commands: | ||
< | <syntaxhighlight lang="bash" style="font-size: 85%;"> | ||
sudo mkdir -p /opt/stacks/mediawiki | |||
sudo mkdir -p /opt/stacks/mediawiki/extensions | |||
cd /opt/stacks/mediawiki | |||
</syntaxhighlight> | |||
'''4. Create the Docker Compose File''' | |||
< | Inside the <code>/opt/stacks/mediawiki</code> directory, create a Docker Compose file: | ||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
touch docker-compose.yml | |||
</syntaxhighlight> | |||
This file will later contain the service definitions for MediaWiki, the database, and related components. | This file will later contain the service definitions for MediaWiki, the database, and related components. | ||
</div> | |||
'''5. Edit the Docker Compose Configuration''' | |||
Now you'll configure the services that will run your MediaWiki installation. | |||
Open the file for editing: | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
nano docker-compose.yml | |||
</syntaxhighlight> | |||
Paste the following configuration into the file: | |||
<syntaxhighlight lang="yaml" style="font-size: 85%;"> | |||
services: | |||
mediawiki: | |||
image: mediawiki | |||
container_name: mediawiki | |||
restart: always | |||
ports: | |||
- "${MEDIAWIKI_PORT}:80" | |||
depends_on: | |||
- database | |||
volumes: | |||
- 230912_images:/var/www/html/images | |||
# EXTENSIONS: Mounts host folder to container | |||
- /opt/stacks/mediawiki/extensions:/var/www/html/extensions | |||
# CONFIG: Uncomment AFTER generating LocalSettings.php | |||
# - /opt/stacks/mediawiki/LocalSettings.php:/var/www/html/LocalSettings.php:ro | |||
database: | |||
image: mariadb | |||
container_name: mediawiki-db | |||
restart: always | |||
environment: | |||
MYSQL_DATABASE: "${MYSQL_DATABASE}" | |||
MYSQL_USER: "${MYSQL_USER}" | |||
MYSQL_PASSWORD: "${MYSQL_PASSWORD}" | |||
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}" | |||
volumes: | |||
- 230912_db:/var/lib/mysql | |||
volumes: | |||
230912_images: | |||
230912_db: | |||
</syntaxhighlight> | |||
Save and exit (press <code>Ctrl + O</code>, then enter, then <code>Ctrl + X</code>). | |||
'''6. Create the Environment Variables File''' | |||
The <code>.env</code> file stores sensitive information like passwords and port numbers. This keeps them separate from your main configuration. | |||
While still in the <code>/opt/stacks/mediawiki</code> directory, create the environment file: | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
sudo touch .env | |||
</syntaxhighlight> | |||
Open it for editing: | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
sudo nano .env | |||
</syntaxhighlight> | |||
Paste the following configuration: | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
# MediaWiki | |||
MEDIAWIKI_PORT=8595 | |||
# Database | |||
DB_IMAGE=mariadb | |||
DB_CONTAINER_NAME=mediawiki-db | |||
MYSQL_DATABASE=my_wiki | |||
MYSQL_USER=wikiuser | |||
MYSQL_PASSWORD=your_secure_password | |||
MYSQL_ROOT_PASSWORD=your_root_password | |||
</syntaxhighlight> | |||
<div style="background-color: #f8f9fa; border-left: 4px solid #3498db; padding: 12px; margin: 15px 0; font-size: 90%;"> | |||
'''Note:''' Change the password values to something secure. Make sure <code>DB_CONTAINER_NAME</code> matches the container name in <code>docker-compose.yml</code> (in this case: <code>mediawiki-db</code>). | |||
</div> | |||
Save and exit. | |||
'''7. Start the MediaWiki Containers''' | |||
With your configuration files ready, start the Docker containers: | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
docker compose up -d | |||
</syntaxhighlight> | |||
The <code>-d</code> flag runs the containers in the background (detached mode). | |||
== Initial MediaWiki Setup == | |||
'''8. Complete the Web Installation Wizard''' | |||
Open your web browser and navigate to: | |||
<syntaxhighlight lang="text" style="font-size: 85%;"> | |||
http://localhost:8595 | |||
</syntaxhighlight> | |||
<div style="background-color: #f8f9fa; border-left: 4px solid #3498db; padding: 12px; margin: 15px 0; font-size: 90%;"> | |||
'''Note:''' If you're setting this up on a remote server, replace <code>localhost</code> with your server's IP address. | |||
</div> | |||
Follow the on-screen setup wizard. When you reach the '''Database Settings''' page, enter these values: | |||
* '''Database host:''' <code>mediawiki-db</code> | |||
* '''Database name:''' <code>my_wiki</code> | |||
* '''Database username:''' <code>wikiuser</code> | |||
* '''Database password:''' <code>your_secure_password</code> | |||
<div style="background-color: #f8f9fa; border-left: 4px solid #3498db; padding: 12px; margin: 15px 0; font-size: 90%;"> | |||
'''Note:''' These values should match what you set in the <code>.env</code> file in Step 6. | |||
</div> | |||
Complete the remaining setup steps, then '''download the <code>LocalSettings.php</code> file''' to your computer when prompted. | |||
'''9. Move LocalSettings.php to the Server''' | |||
Copy the downloaded configuration file from your local machine to the MediaWiki directory on your server: | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
sudo cp ~/Downloads/LocalSettings.php /opt/stacks/mediawiki/ | |||
</syntaxhighlight> | |||
<div style="background-color: #f8f9fa; border-left: 4px solid #3498db; padding: 12px; margin: 15px 0; font-size: 90%;"> | |||
'''Note:''' Adjust the path <code>~/Downloads/</code> if your file was saved to a different location. | |||
</div> | |||
== Configuring Extensions == | |||
'''10. Extract Default Extensions (The "Magic Command")''' | |||
MediaWiki comes with built-in extensions that need to be extracted to your host directory. | |||
'''Step A: Extract Extensions''' | |||
Run this command to copy all default extensions from the container to your host: | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
docker run --rm mediawiki tar -cC /var/www/html/extensions . | sudo tar -xC /opt/stacks/mediawiki/extensions | |||
</syntaxhighlight> | |||
'''Step B: Fix File Permissions''' | |||
Set the correct ownership and permissions so MediaWiki can use these extensions: | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
sudo chown -R 33:33 /opt/stacks/mediawiki/extensions | |||
sudo chmod -R 755 /opt/stacks/mediawiki/extensions | |||
</syntaxhighlight> | |||
<div style="background-color: #f8f9fa; border-left: 4px solid #3498db; padding: 12px; margin: 15px 0; font-size: 90%;"> | |||
'''Note:''' User ID <code>33</code> is the web server user (www-data) inside the container. | |||
</div> | |||
'''Step C: Add External Extensions (Optional)''' | |||
To add extensions not included by default, download them to the extensions folder. For example, to add the Mermaid diagram extension: | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
cd /opt/stacks/mediawiki/extensions | |||
git clone https://github.com/SemanticMediaWiki/Mermaid.git Mermaid | |||
sudo chown -R 33:33 Mermaid | |||
</syntaxhighlight> | |||
<div style="background-color: #f8f9fa; border-left: 4px solid #3498db; padding: 12px; margin: 15px 0; font-size: 90%;"> | |||
'''Note:''' Skip this step if you don't need the Mermaid extension or already have it installed. | |||
</div> | |||
To add the Lockdown extension (required for private namespaces): | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
cd /opt/stacks/mediawiki/extensions | |||
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Lockdown.git | |||
sudo chown -R 33:33 Lockdown | |||
</syntaxhighlight> | |||
== Activating LocalSettings.php == | |||
'''11. Enable the LocalSettings Mount''' | |||
Now that <code>LocalSettings.php</code> exists on your server, you need to mount it into the container. | |||
Open the Docker Compose file again: | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
nano docker-compose.yml | |||
</syntaxhighlight> | |||
Find this commented line in the <code>mediawiki</code> service section: | |||
<syntaxhighlight lang="yaml" style="font-size: 85%;"> | |||
# - /opt/stacks/mediawiki/LocalSettings.php:/var/www/html/LocalSettings.php:ro | |||
</syntaxhighlight> | |||
Remove the <code>#</code> to uncomment it: | |||
<syntaxhighlight lang="yaml" style="font-size: 85%;"> | |||
- /opt/stacks/mediawiki/LocalSettings.php:/var/www/html/LocalSettings.php:ro | |||
</syntaxhighlight> | |||
Save and exit. | |||
'''12. Customize LocalSettings.php - Basic Configuration''' | |||
Open the LocalSettings file for editing: | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
sudo nano /opt/stacks/mediawiki/LocalSettings.php | |||
</syntaxhighlight> | |||
'''A. Set Your Custom Domain''' | |||
Find the line that starts with <code>$wgServer</code> and update it with your actual domain or IP address: | |||
<syntaxhighlight lang="php" style="font-size: 85%;"> | |||
$wgServer = "https://mediawiki.yourdomain.com"; | |||
</syntaxhighlight> | |||
<div style="background-color: #f8f9fa; border-left: 4px solid #3498db; padding: 12px; margin: 15px 0; font-size: 90%;"> | |||
'''Note:''' Use <code>http://</code> if you haven't set up SSL/HTTPS yet. For local testing, use <code>http://localhost:8595</code>. | |||
</div> | |||
'''B. Add Basic Extensions Configuration''' | |||
Scroll to the very bottom of the file and paste this configuration block: | |||
<syntaxhighlight lang="php" style="font-size: 85%;"> | |||
/*------------------------------------------- | |||
CUSTOM PERMISSIONS & EXTENSIONS | |||
----------------------------------------- */ | |||
// 1. SECURITY: Prevent anonymous editing and account creation | |||
$wgGroupPermissions['*']['edit'] = false; | |||
$wgGroupPermissions['*']['createaccount'] = false; | |||
// 2. BUNDLED EXTENSIONS | |||
wfLoadExtension( 'WikiEditor' ); | |||
wfLoadExtension( 'VisualEditor' ); | |||
wfLoadExtension( 'CodeEditor' ); | |||
wfLoadExtension( 'SyntaxHighlight_GeSHi' ); # REQUIRED for Code Blocks | |||
wfLoadExtension( 'Cite' ); | |||
wfLoadExtension( 'InputBox' ); | |||
wfLoadExtension( 'Scribunto' ); | |||
wfLoadExtension( 'AbuseFilter' ); | |||
wfLoadExtension( 'Gadgets' ); | |||
wfLoadExtension( 'ParserFunctions' ); | |||
// wfLoadExtension( 'Interwiki' ); # Moved to core in MediaWiki 1.44.0 | |||
// 3. EXTERNAL EXTENSIONS | |||
wfLoadExtension( 'Mermaid' ); | |||
// 4. VISUALEDITOR CONFIGURATION | |||
$wgDefaultUserOptions['visualeditor-enable'] = 1; | |||
$wgVisualEditorParsoidForwardCookies = true; | |||
// 5. LUA CONFIGURATION (Required for Scribunto) | |||
$wgScribuntoDefaultEngine = 'luastandalone'; | |||
// 6. LOGIN SECURITY: Throttle login attempts | |||
$wgRateLimits['user']['login'] = [ 5, 60 ]; // 5 attempts per minute | |||
$wgRateLimits['ip']['login'] = [ 20, 300 ]; // 20 attempts per 5 minutes | |||
</syntaxhighlight> | |||
<div style="background-color: #f8f9fa; border-left: 4px solid #3498db; padding: 12px; margin: 15px 0; font-size: 90%;"> | |||
'''Note:''' The <code>Interwiki</code> extension is commented out because its functionality was moved to MediaWiki core in version 1.44.0. If you're using an older version, uncomment this line. | |||
</div> | |||
Save and exit. | |||
== Finalizing the Basic Installation == | |||
'''13. Update the Database Schema''' | |||
After enabling extensions, update the MediaWiki database to recognize them: | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
docker exec -it mediawiki php maintenance/update.php --quick | |||
</syntaxhighlight> | |||
'''14. Restart the Containers''' | |||
Apply all changes by restarting the Docker containers: | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
docker compose up -d | |||
</syntaxhighlight> | |||
== Basic Verification == | |||
Your basic MediaWiki installation is now complete. Visit your wiki in a web browser: | |||
<syntaxhighlight lang="text" style="font-size: 85%;"> | |||
http://localhost:8595 | |||
</syntaxhighlight> | |||
You should see your wiki homepage with basic extensions activated. | |||
== Next Steps == | |||
Your basic MediaWiki installation is now running! | |||
To add advanced features like: | |||
* Custom logos and modern themes | |||
* Email notifications via SMTP | |||
* Multi-level permission systems | |||
* Private namespaces for confidential content | |||
* Two-factor authentication for administrators | |||
* Additional security and content extensions | |||
Please proceed to the '''[[MediaWiki Additional Configuration Guide]]'''. | |||
== Troubleshooting == | |||
'''General troubleshooting commands:''' | |||
* '''Check container logs:''' | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
docker compose logs -f | |||
</syntaxhighlight> | |||
* '''Restart containers:''' | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
docker compose restart | |||
</syntaxhighlight> | |||
* '''Verify file permissions:''' | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
ls -la /opt/stacks/mediawiki/ | |||
</syntaxhighlight> | |||
* '''Check if MediaWiki container is running:''' | |||
<syntaxhighlight lang="bash" style="font-size: 85%;"> | |||
docker ps | |||
</syntaxhighlight> | |||
== Summary == | |||
You've successfully set up a basic MediaWiki installation with: | |||
✓ Docker containerization for easy management | |||
<br> | |||
✓ MariaDB database backend | |||
<br> | |||
✓ Essential extensions enabled | |||
<br> | |||
✓ Basic security settings | |||
<br> | |||
✓ Ready for additional configuration | |||
'''''Your basic wiki is now ready! Proceed to the Additional Configuration Guide to unlock more features.''''' | |||
Latest revision as of 06:13, 12 February 2026
MediaWiki Docker Setup Guide
This guide walks you through setting up MediaWiki using Docker and Dockhand. Follow the steps carefully, as specific paths are required for extensions and configuration to work correctly.
Getting Started
Before proceeding, make sure you have access to a Linux server or local machine with sudo privileges.
Installation Steps
1. Install Docker and Docker Compose
Ensure that Docker and Docker Compose are installed on your system. These tools are required to run MediaWiki and its supporting services in containers.
2. Set Up Dockhand
Dockhand provides a simple web-based interface for managing Docker stacks.
Run the following command in your terminal:
# Use matching paths with DATA_DIR
docker run -d \
--name dockhand \
-p 3000:3000 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /opt/dockhand:/opt/dockhand \
-e DATA_DIR=/opt/dockhand \
fnsys/dockhand:latest
Once the container is running, open your browser and go to:
http://localhost:3000
You should now see the Dockhand web interface.
3. Create the MediaWiki Stack Directory
Next, create a dedicated directory on the Docker host for your MediaWiki stack.
This location is important because it will store your configuration files and extensions.
Run the following commands:
sudo mkdir -p /opt/stacks/mediawiki
sudo mkdir -p /opt/stacks/mediawiki/extensions
cd /opt/stacks/mediawiki
4. Create the Docker Compose File
Inside the /opt/stacks/mediawiki directory, create a Docker Compose file:
touch docker-compose.yml
This file will later contain the service definitions for MediaWiki, the database, and related components.
5. Edit the Docker Compose Configuration
Now you'll configure the services that will run your MediaWiki installation.
Open the file for editing:
nano docker-compose.yml
Paste the following configuration into the file:
services:
mediawiki:
image: mediawiki
container_name: mediawiki
restart: always
ports:
- "${MEDIAWIKI_PORT}:80"
depends_on:
- database
volumes:
- 230912_images:/var/www/html/images
# EXTENSIONS: Mounts host folder to container
- /opt/stacks/mediawiki/extensions:/var/www/html/extensions
# CONFIG: Uncomment AFTER generating LocalSettings.php
# - /opt/stacks/mediawiki/LocalSettings.php:/var/www/html/LocalSettings.php:ro
database:
image: mariadb
container_name: mediawiki-db
restart: always
environment:
MYSQL_DATABASE: "${MYSQL_DATABASE}"
MYSQL_USER: "${MYSQL_USER}"
MYSQL_PASSWORD: "${MYSQL_PASSWORD}"
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}"
volumes:
- 230912_db:/var/lib/mysql
volumes:
230912_images:
230912_db:
Save and exit (press Ctrl + O, then enter, then Ctrl + X).
6. Create the Environment Variables File
The .env file stores sensitive information like passwords and port numbers. This keeps them separate from your main configuration.
While still in the /opt/stacks/mediawiki directory, create the environment file:
sudo touch .env
Open it for editing:
sudo nano .env
Paste the following configuration:
# MediaWiki
MEDIAWIKI_PORT=8595
# Database
DB_IMAGE=mariadb
DB_CONTAINER_NAME=mediawiki-db
MYSQL_DATABASE=my_wiki
MYSQL_USER=wikiuser
MYSQL_PASSWORD=your_secure_password
MYSQL_ROOT_PASSWORD=your_root_password
Note: Change the password values to something secure. Make sure DB_CONTAINER_NAME matches the container name in docker-compose.yml (in this case: mediawiki-db).
Save and exit.
7. Start the MediaWiki Containers
With your configuration files ready, start the Docker containers:
docker compose up -d
The -d flag runs the containers in the background (detached mode).
Initial MediaWiki Setup
8. Complete the Web Installation Wizard
Open your web browser and navigate to:
http://localhost:8595
Note: If you're setting this up on a remote server, replace localhost with your server's IP address.
Follow the on-screen setup wizard. When you reach the Database Settings page, enter these values:
- Database host:
mediawiki-db - Database name:
my_wiki - Database username:
wikiuser - Database password:
your_secure_password
Note: These values should match what you set in the .env file in Step 6.
Complete the remaining setup steps, then download the LocalSettings.php file to your computer when prompted.
9. Move LocalSettings.php to the Server
Copy the downloaded configuration file from your local machine to the MediaWiki directory on your server:
sudo cp ~/Downloads/LocalSettings.php /opt/stacks/mediawiki/
Note: Adjust the path ~/Downloads/ if your file was saved to a different location.
Configuring Extensions
10. Extract Default Extensions (The "Magic Command")
MediaWiki comes with built-in extensions that need to be extracted to your host directory.
Step A: Extract Extensions
Run this command to copy all default extensions from the container to your host:
docker run --rm mediawiki tar -cC /var/www/html/extensions . | sudo tar -xC /opt/stacks/mediawiki/extensions
Step B: Fix File Permissions
Set the correct ownership and permissions so MediaWiki can use these extensions:
sudo chown -R 33:33 /opt/stacks/mediawiki/extensions
sudo chmod -R 755 /opt/stacks/mediawiki/extensions
Note: User ID 33 is the web server user (www-data) inside the container.
Step C: Add External Extensions (Optional)
To add extensions not included by default, download them to the extensions folder. For example, to add the Mermaid diagram extension:
cd /opt/stacks/mediawiki/extensions
git clone https://github.com/SemanticMediaWiki/Mermaid.git Mermaid
sudo chown -R 33:33 Mermaid
Note: Skip this step if you don't need the Mermaid extension or already have it installed.
To add the Lockdown extension (required for private namespaces):
cd /opt/stacks/mediawiki/extensions
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Lockdown.git
sudo chown -R 33:33 Lockdown
Activating LocalSettings.php
11. Enable the LocalSettings Mount
Now that LocalSettings.php exists on your server, you need to mount it into the container.
Open the Docker Compose file again:
nano docker-compose.yml
Find this commented line in the mediawiki service section:
# - /opt/stacks/mediawiki/LocalSettings.php:/var/www/html/LocalSettings.php:ro
Remove the # to uncomment it:
- /opt/stacks/mediawiki/LocalSettings.php:/var/www/html/LocalSettings.php:ro
Save and exit.
12. Customize LocalSettings.php - Basic Configuration
Open the LocalSettings file for editing:
sudo nano /opt/stacks/mediawiki/LocalSettings.php
A. Set Your Custom Domain
Find the line that starts with $wgServer and update it with your actual domain or IP address:
$wgServer = "https://mediawiki.yourdomain.com";
Note: Use http:// if you haven't set up SSL/HTTPS yet. For local testing, use http://localhost:8595.
B. Add Basic Extensions Configuration
Scroll to the very bottom of the file and paste this configuration block:
/*-------------------------------------------
CUSTOM PERMISSIONS & EXTENSIONS
----------------------------------------- */
// 1. SECURITY: Prevent anonymous editing and account creation
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['createaccount'] = false;
// 2. BUNDLED EXTENSIONS
wfLoadExtension( 'WikiEditor' );
wfLoadExtension( 'VisualEditor' );
wfLoadExtension( 'CodeEditor' );
wfLoadExtension( 'SyntaxHighlight_GeSHi' ); # REQUIRED for Code Blocks
wfLoadExtension( 'Cite' );
wfLoadExtension( 'InputBox' );
wfLoadExtension( 'Scribunto' );
wfLoadExtension( 'AbuseFilter' );
wfLoadExtension( 'Gadgets' );
wfLoadExtension( 'ParserFunctions' );
// wfLoadExtension( 'Interwiki' ); # Moved to core in MediaWiki 1.44.0
// 3. EXTERNAL EXTENSIONS
wfLoadExtension( 'Mermaid' );
// 4. VISUALEDITOR CONFIGURATION
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgVisualEditorParsoidForwardCookies = true;
// 5. LUA CONFIGURATION (Required for Scribunto)
$wgScribuntoDefaultEngine = 'luastandalone';
// 6. LOGIN SECURITY: Throttle login attempts
$wgRateLimits['user']['login'] = [ 5, 60 ]; // 5 attempts per minute
$wgRateLimits['ip']['login'] = [ 20, 300 ]; // 20 attempts per 5 minutes
Note: The Interwiki extension is commented out because its functionality was moved to MediaWiki core in version 1.44.0. If you're using an older version, uncomment this line.
Save and exit.
Finalizing the Basic Installation
13. Update the Database Schema
After enabling extensions, update the MediaWiki database to recognize them:
docker exec -it mediawiki php maintenance/update.php --quick
14. Restart the Containers
Apply all changes by restarting the Docker containers:
docker compose up -d
Basic Verification
Your basic MediaWiki installation is now complete. Visit your wiki in a web browser:
http://localhost:8595
You should see your wiki homepage with basic extensions activated.
Next Steps
Your basic MediaWiki installation is now running!
To add advanced features like:
- Custom logos and modern themes
- Email notifications via SMTP
- Multi-level permission systems
- Private namespaces for confidential content
- Two-factor authentication for administrators
- Additional security and content extensions
Please proceed to the MediaWiki Additional Configuration Guide.
Troubleshooting
General troubleshooting commands:
- Check container logs:
docker compose logs -f
- Restart containers:
docker compose restart
- Verify file permissions:
ls -la /opt/stacks/mediawiki/
- Check if MediaWiki container is running:
docker ps
Summary
You've successfully set up a basic MediaWiki installation with:
✓ Docker containerization for easy management
✓ MariaDB database backend
✓ Essential extensions enabled
✓ Basic security settings
✓ Ready for additional configuration
Your basic wiki is now ready! Proceed to the Additional Configuration Guide to unlock more features.