How to Install Mediawiki on Alpine Linux Latest

In this tutorial, we will guide you through the process of installing Mediawiki on Alpine Linux Latest. Mediawiki is a popular and powerful wiki application that allows users to create and edit content collaboratively. Alpine Linux is a lightweight and secure distribution of Linux, which makes it an excellent choice for hosting Mediawiki.

Prerequisites

Before we start the installation process, you need to make sure that you have the following prerequisites:

Step 1: Update the System

The first step before installing any software is to update the system packages to their latest version. You can do it by running the following command in the terminal:

sudo apk update && sudo apk upgrade

Step 2: Install Apache web server

Mediawiki requires a web server to run, so you need to install Apache web server first. You can do it by running the following command:

sudo apk add apache2

After the installation is complete, start the Apache web server service by running the following command:

sudo rc-service apache2 start

Step 3: Install PHP

Mediawiki is written in PHP, so you need to install PHP on your Alpine Linux instance. You can do it by running the following command:

sudo apk add php7 php7-apache2 php7-json php7-mbstring php7-xml php7-mysqli

After the installation is complete, restart the Apache web server service by running the following command:

sudo rc-service apache2 restart

Step 4: Install Mediawiki

Now, we are ready to install the Mediawiki application. You can download the latest stable release from the official Mediawiki website.

wget https://releases.wikimedia.org/mediawiki/1.35/mediawiki-1.35.2.tar.gz

Extract the downloaded package in the root directory of your Apache web server by using the following command:

sudo tar -C /var/www/ -xzvf mediawiki-1.35.2.tar.gz

The tar command extracts the package contents to the /var/www/ directory.

Now, rename the extracted directory with the following command:

sudo mv /var/www/mediawiki-1.35.2 /var/www/mediawiki

Step 5: Configure the Mediawiki Database

Mediawiki requires a database to store its content. In this tutorial, we will use MySQL as our database. You can install MySQL on your Alpine Linux instance by running the following command:

sudo apk add mariadb mariadb-client

After the installation is complete, set up the MySQL root password and start the MySQL service, run the following commands:

sudo mysql_secure_installation
sudo rc-service mariadb start

Now, create a new database and user for the Mediawiki application. You can do it by running the following commands:

sudo mysql -u root -p
create database mediawiki;
create user 'wikiuser'@'localhost' identified by 'password';
grant all privileges on mediawiki.* to 'wikiuser'@'localhost';
flush privileges;
exit;

In the above commands, replace password with your preferred database user password.

Step 6: Complete Mediawiki Installation

Now, we are ready to complete the Mediawiki installation by navigating to the http://localhost/mediawiki URL in your web browser.

Follow the on-screen instructions to set up the Mediawiki application. In the "Database settings" section, enter the following:

Complete the installation wizard, and you are ready to use Mediawiki on your Alpine Linux instance.

Conclusion

In this tutorial, we have shown how to install Mediawiki on Alpine Linux Latest. With Mediawiki, you can create and manage a collaborative wiki website for your organization or personal use.

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!