Step 1: Check the Fedora CoreOS Version
Before you start to install Mediawiki on Fedora CoreOS, it is essential to verify that you have the latest version. To check the version, enter the following command:
$ cat /etc/os-release
It will display the Fedora CoreOS version installed on your system.
Step 2: Install Mediawiki Dependencies
Before installing the Mediawiki, you must install some essential software dependencies required by Mediawiki. Run the command below to install Apache, PHP, and MariaDB:
$ sudo rpm-ostree install httpd php php-mysqlnd mariadb mariadb-server
Step 3: Install Mediawiki
Follow the steps below to install Mediawiki:
$ cd /var/www/html/
$ sudo curl -O https://releases.wikimedia.org/mediawiki/1.35/mediawiki-1.35.0.tar.gz
$ sudo tar -xzf mediawiki-1.35.0.tar.gz
$ sudo mv mediawiki-1.35.0 mediawiki
The above commands will download and extract the Mediawiki archive to /var/www/html/mediawiki directory.
Step 4: Setup the Database
Now that you have installed Mediawiki and its dependencies, you need to set up the database.
$ sudo systemctl start mariadb
$ sudo mysql_secure_installation
$ sudo mysql -u root -p
Note: You might enter the MariaDB password while running the above command.
MariaDB [(none)]> CREATE DATABASE wikidatabase;
MariaDB [(none)]> CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'password';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON wikidatabase.* TO 'wikiuser'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;
Run the above commands to create a new database named wikidatabase and a new user named wikiuser with the password 'password'.
Step 5: Configure Apache for Mediawiki
To configure the Apache webserver, follow the steps below:
$ sudo cp /var/www/html/mediawiki/htaccess /var/www/html/mediawiki/.htaccess
$ sudo chown apache:apache /var/www/html/mediawiki/ -R
The above commands take care of setting up the webserver and make sure that the necessary permissions are set up.
Step 6: Configure Mediawiki
To complete the configuration, open the /var/www/html/mediawiki/LocalSettings.php file and add the following lines at the bottom of the file:
$ sudo nano /var/www/html/mediawiki/LocalSettings.php
## Edit the file and add the below configuration ##
$wgServer = "http://localhost";
$wgSitename = "MyWikiSite";
$wgMetaNamespace = "MyWiki";
$wgDBname = "wikidatabase";
$wgDBuser = "wikiuser";
$wgDBpassword = "password";
Save and close the file. Once you complete the above configuration settings, you can browse your Mediawiki website on your web browser.
Conclusion
Congratulations! You have successfully installed Mediawiki on your Fedora CoreOS server. You can now head to the web browser, enter the URL of your site, and start adding content to your new Wiki site.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!