Running MediaWiki in Docker on Ubuntu Server
#MediaWiki #Wikipedia #Docker
*** Updated 08/19/2024
Full steps can be found at https://i12bretro.github.io/tutorials...
What is MediaWiki?
The MediaWiki software is used by tens of thousands of websites and thousands of companies and organizations. It powers Wikipedia and also this website. MediaWiki helps you collect and organize knowledge and make it available to people. It's powerful, multilingual, free and open, extensible, customizable, reliable, and free of charge. - https://www.mediawiki.org/wiki/MediaWiki
Installing Docker
01. Log into the Linux host and run the following commands in a terminal window
update software respositories
sudo apt update
install available software updates
sudo apt upgrade -y
install prerequisites
sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
add docker gpg key
curl -fsSL https://download.docker.com/linux/ubu... | sudo apt-key add -
add docker apt repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
install docker
sudo apt install docker-ce docker-compose containerd.io -y
add the current user to the docker group
sudo usermod -aG docker $USER
reauthenticate for the new group membership to take effect
su - $USER
Running MediaWiki Container
01. Continue with the following commands in a terminal window
create working directories
mkdir /home/$USER/docker/mediawiki/images -p && mkdir /home/$USER/docker/mariadb -p
set owner of working directories
sudo chown "$USER":"$USER" /home/"$USER"/docker -R
create containers network
docker network create containers
run the mariadb docker container
docker run --name mariadb -e MYSQL_ROOT_PASSWORD=r00tp@$$ -e MYSQL_USER=mediawiki_rw -e MYSQL_PASSWORD=WikiW1k1What! -e MYSQL_DATABASE=mediawiki -v /home/$USER/docker/mariadb:/var/lib/mysql --network containers --restart=unless-stopped -d mariadb:latest
run the mediawiki docker container
docker run -d --name mediawiki -p 8080:80 -e MYSQL_USER=mediawiki_rw -e MYSQL_PASSWORD=WikiW1k1What! -e MYSQL_DATABASE=mediawiki -v /home/$USER/docker/mediawiki/images:/var/www/html/images --network containers mediawiki:latest
02. Open a web browser and navigate to http://DNSorIP:8080
03. Scroll to the bottom and click the set up the wiki link
04. Set the Languages ≫ Click Continue
05. Click Continue at the Welcome screen
06. Complete the Database settings as follows:
Database type:
Database host: mariadb
Database name: mediawiki
Database table prefix:
Database username: mediawiki_rw
Database password: WikiW1k1What!
07. Click Continue
08. Leave the Use the same account as for installation box checked ≫ Click Continue
09. Give the Wiki a name and create an administrator username and password
10. Uncheck the Share data about this installation with MediaWiki developers box
11. Check the I'm bored already, just install the wiki box ≫ Click Continue
12. Click Continue again to begin the installation
13. After the installation completes click Continue
14. At the Download LocalSettings.php page, download the file
15. Open the downloaded LocalSettings.php and copy the contents to the clipboard
16. Back on the Docker host, run the following command to create LocalSettings.php in the correct location
create and edit LocalSettings.php
nano /home/$USER/docker/mediawiki/LocalSettings.php
17. Paste the copied contents from the downloaded LocalSettings.php
18. Press CTRL+O, Enter, CTRL+X to write the changes
19. Continue with the following commands
remove mediawiki container
docker rm mediawiki --force
re-initialize mediawiki container with local settings
docker run -d --name mediawiki -p 8080:80 -e MYSQL_USER=mediawiki_rw -e MYSQL_PASSWORD=WikiW1k1What! -e MYSQL_DATABASE=mediawiki -v /home/$USER/docker/mediawiki/images:/var/www/html/images -v /home/$USER/docker/mediawiki/LocalSettings.php:/var/www/html/LocalSettings.php --network containers --restart=unless-stopped mediawiki:latest
allow the container to write to working directories
sudo chmod a+rwx -R ~/docker
20. Back in the browser click the enter your wiki link
21. Click the Log In link at the top right
22. Log in with the administrator account created during the setup
23. Welcome to MediaWiki
Source: https://hub.docker.com/_/mediawiki
Connect with me and others ###
★ Discord: / discord
★ Reddit: / i12bretro
★ Twitter: / i12bretro