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
- 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/ubuntu/gpg | 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
- 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 - Open a web browser and navigate to http://DNSorIP:8080
- Scroll to the bottom and click the set up the wiki link
- Set the Languages > Click Continue
- Click Continue at the Welcome screen
- Complete the Database settings as follows:
Database type:
Database host: mariadb
Database name: mediawiki
Database table prefix:
Database username: mediawiki_rw
Database password: WikiW1k1What! - Click Continue
- Leave the Use the same account as for installation box checked > Click Continue
- Give the Wiki a name and create an administrator username and password
- Uncheck the Share data about this installation with MediaWiki developers box
- Check the I'm bored already, just install the wiki box > Click Continue
- Click Continue again to begin the installation
- After the installation completes click Continue
- At the Download LocalSettings.php page, download the file
- Open the downloaded LocalSettings.php and copy the contents to the clipboard
- 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 - Paste the copied contents from the downloaded LocalSettings.php
- Press CTRL+O, Enter, CTRL+X to write the changes
- 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 - Back in the browser click the enter your wiki link
- Click the Log In link at the top right
- Log in with the administrator account created during the setup
- Welcome to MediaWiki