Setting up MediaWiki

From Novoyuuparosk Wiki
Revision as of 12:47, 4 July 2023 by Mikkeli (talk | contribs)

This might seem somewhat amusing, having a how to set up MediaWiki inside a MediaWiki, at first thought.

However it's actually quite important as people (I) forget the process how they done something 5 weeks after the initial action, and software they always fail in one way or another.

So as a panic suppressor in case something goes wrong, I will keep track of how this MediaWiki instance was set up. This way I can look at this and figure out how to fix the problem, hopefully.

Preparations

The process can't really be done without the help of ChatGPT. Although its knowledge is cutoff at September 2021 (or as it insists), there seem to be sufficient MediaWiki-related knowledge in OpenAI's pandora box.

But you essentially cannot set up a MediaWiki only with ChatGPT. You need

  • A (Linux) server. I prefer APT-based distros like Debian or Ubuntu, I might migrate to NixOS when I master the dark arts of Nix but not now. Linux because I don't really know how to work with any other server OSes.
  • Web server, Apache 2 or Nginx. I use Nginx because it advertises itself to be 'a lightweight web server' and the name is cooler.
  • PHP and all the necessary modules. Will discuss in detail in relative sections.
    • php-intl for Unicode parsing. Probably useful for a multilingual Wiki like this.
  • Certbot for setting up HTTPS certificate and automatically renewing it. Skip this if you like the terrifying 'Not secure' prompt.
    • Preferably a domain name. I am not sure if you can get a HTTPS cert with only the IP address. My knowledge says you can't.
  • MySQL or PostgreSQL or SQLite. These are the 3 options supported and required by MediaWiki to set up the database. I somehow managed to break MariaDB completely on this server so I had to resort to SQLite because it looked like the least troublesome. Using some MySQL compatible might be the most traditional choice but someone close said Postgre is ages ahead of MySQL so I really have no idea now.
  • Several essential Linux utilities such as ssh, wget, tar/unzip/7z, etc, etc.
    • imagemagick (convert) for MediaWiki to generate thumbnails on the fly.
    • ufw if you want to open up ports without having to have an American fleet.
  • I'll add to this if I notice anything I forgot.

Environment setup

The whole thing starts with setting up the Linux server but we'll skip it here. Nowadays you just go into any VPS provider and pick their cheapest plan and you usually get a working Linux server with public IP address. That's very neat if you ask me.

I'll also skip the domain name acquisition and DNS setup because I know neither how it actually works nor how I made it to work. That should be a proof that any dummy can do it if they decided to.

Suppose that the most essential utilities are already ready installed, I'll start from Nginx.

Installing Nginx, PHP and SQLite

Do a apt update first.