Run MediaWiki with Docker
- Introduction
- Step 1 - Start MediaWiki with Docker
- Step 2 - First setup
- Step 3 - Uncomment LocalSettings.php
- Step 4 - Log into the site
- Appendix A - Options
- Appendix B - First setup
Introduction
This runs MediaWiki in a docker container which removes the need to install anything on your machine except for Docker and Git.
Step 1 - Start MediaWiki with Docker
You will need Docker installed. Open a terminal window and run each of the commands below. If you don’t have Git installed, then the system will ask you to install it the first time it’s run. The final command will continue to running while the site is running. Wait until the scrolling stops and open http://localhost:8080.
git clone git@github.com:patrick-melo/mediawiki.git
cd mediawiki
docker-compose up
Step 2 - First setup
Wait for the mediawiki-mysql-1
messages to stop scrolling on the screen. The last message should read ready for connections
. When you see this message, run the following command to set up the wiki:
docker exec -it mediawiki-mediawiki-1 php maintenance/install.php \
--with-extensions \
--dbserver mysql \
--dbuser root \
--dbpass supersecretpassword \
--server "http://127.0.0.1:8080" \
--scriptpath "" \
--pass supersecretpassword \
wiki wikiadmin
Step 3 - Uncomment LocalSettings.php
Uncomment line 9 in the docker-compose.yml
in this repo and restart docker-compose up
. you will need to press Ctrl+C
to stop the existing process.
Step 4 - Log into the site
You can now log into the site with the following credentials:
Username: wikiadmin
Password: supersecretpassword
Appendix A - Options
If you would rather not have to log into the website, then comment the following lines in LocalSettings.php
.
$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['read'] = false;
Appendix B - First setup
The command above renders these steps unnecessary but I’ve included them here for information purposes. They’re how I generated the LocalSettings.php
file.
First setup steps
These steps
- Open http://127.0.0.1:8080/
- On the splash screen, click “set up the wiki”.
- On the “Language” screen, click the “continue” button.
- On the “Welcome to MediaWiki!” screen, click the “continue” button.
-
On the “Connect to database” screen, set the following values and click the “continue” button.
Database type: MariaDB, MySQL, or compatible Database host: mysql Database name (no hyphens): my_wiki Database table prefix (no hyphens): Database username: root Database password: supersecretpassword
- On the “Database settings” screen, click the “continue” button.
-
On the “Name” screen, set the following values, and click the “continue” button.
Name of wiki: wiki Project namespace: Same as the wiki name: Wiki Your username: wikiadmin Password: supersecretpassword Password again: supersecretpassword
-
On the “Options” screen, set the following values, and click the “continue” button.
User rights profile: Private wiki
- On the “Install” screen, click the “continue” button.
- On the second “Install” screen, click the “continue” button.
- On the “Complete” download the “LocalSettings.php” file.
Comments
Join the discussion for this article on this ticket. Comments appear on this page instantly.