Part 1 – OS Installation Details
This will be an actual ‘How To’. As I am concentrating on Ubuntu Linux 20.04, it will be very 20.04 ‘centric, however much will apply to all OS releases. There are numerous HowTo guides on installing Mediawiki on Ubuntu but after viewing a few of the pages searched for via your favorite search engine, you’ll quickly discover that most of them have been copied verbatim from the same source, or have been minimally modified.
Assumptions I am making are that you know what a web server is, you know what Mediawiki is, you know how to perform basic administration tasks of your Ubuntu server and you are proficient enough at using your terminal or bash shell to follow along and enter commands. As mentioned in earlier articles on the site everything will be command line based. So please be comfortable with the environment.
I have built a fresh Ubuntu server from scratch and will be performing and outlining the steps in correlation to the actual commands entered in the shell being synced with this HowTo, so let’s go.
Step 1: Install all required software and subsystems:
apt install apache2 mysql-server php mediawiki
Step 2: Confirm Apache2 Server is Running
- Point your browser at the IP address of the your Ubuntu machine and you should get the ‘Apache2 Ubuntu Default Page’
Step 3: Install Mediawiki Support Software
apt install php-mysql libapache2-mod-php php-mbstring php-apcu imagemagick php-imagick inkscape php-gd php-cli git php-bcmath
NOTE: That's one single line so care with copying
Step 4: Install Certbot and Let’s Encrypt SSL Certificate. NOTE: This portion will ONLY work if your on your server, it is connected to the internet, and you have the public DNS name reachable through web browser, or any web browser in the world for that matter. If this does not apply to you, then skip to the next portion for your local Mediawiki installation configuration.
install snapd ; snap install core ; snap refresh core
snap install --classic certbot
ln -s /snap/bin/certbot /usr/bin/certbot
- At this point in the installation of certbot it will ask you a series of questions. I remember the answers as <enter contact email>, Y, N, <enter domain address for ssl certificate>. (I don’t have the extra domain to test this atm however will update in the short term.
- Once you’ve completed this portion of the SSL certificate installation certbot will perform it’s magic and install the ssl certificate, update your apache installation and enable ssl. Use your browser and point it at https://your-ssl-enabled-site for confirmation.
Step 5: Configure MySQL database for Mediawiki Database and Table (enter each of the following commands in mysql followed by <enter/return>; don’t forget semicolons).
create database mediawiki;
create user 'mediawiki'@'localhost' identified by 'password';
grant all privileges on mediawiki.* to 'mediawiki'@'localhost';
At this point the OS portion of the installation is complete. We will go through the 5 to 10 pages of the Mediawiki installation that is performed via the web browser in Part 2.
You can however at this point go ahead and start the Mediawiki web based portion of the installation by pointing your browser at http[s]://your-site/mediawiki and skipping part 2, if you are so inclined.