How to Install Mediawiki on POP! OS Latest

This tutorial will guide you through the steps to install MediaWiki on POP! OS latest.

Before we begin, make sure your system is up to date:

sudo apt update
sudo apt upgrade
sudo apt autoremove

1. Install Apache Web Server and PHP

MediaWiki is a web-based application, so we need to install a web server and PHP to serve pages.

Run the following commands to install Apache and PHP:

sudo apt install apache2 php libapache2-mod-php php-mbstring php-xml php-mysql

2. Create a Database for MediaWiki

MediaWiki uses a database to store its content, so we need to create a new MySQL/MariaDB database.

Log in to MySQL/MariaDB using the root account:

sudo mysql -u root -p

Enter your password when prompted.

Create a new database for MediaWiki:

CREATE DATABASE mediawiki;

Create a new MySQL/MariaDB user and grant privileges to the database:

CREATE USER 'mediawikiuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON mediawiki.* TO 'mediawikiuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace password with your preferred password.

3. Download and Install MediaWiki

Switch to the /var/www/html/ directory and download MediaWiki:

cd /var/www/html/
sudo wget https://releases.wikimedia.org/mediawiki/1.35/mediawiki-1.35.2.tar.gz

Extract the downloaded archive:

sudo tar xzf mediawiki-1.35.2.tar.gz

Move the extracted directory to a more user-friendly name, for example, simply mediawiki:

sudo mv mediawiki-1.35.2 mediawiki

Give the web server user ownership of the MediaWiki files:

sudo chown -R www-data:www-data mediawiki/

4. Configure MediaWiki

Open a web browser and go to http://your-server-ip/mediawiki. You should see the MediaWiki installation page.

Follow the on-screen instructions to complete the installation. When prompted, enter the database information you created in step 2.

After the installation is complete, MediaWiki will generate a LocalSettings.php file. Copy the contents of this file to the clipboard.

sudo cat /var/www/html/mediawiki/LocalSettings.php | xclip -sel clip

5. Finalize Apache Configuration

Open the Apache configuration file with your favorite text editor:

sudo nano /etc/apache2/sites-available/000-default.conf

Add the following lines at the end of the <VirtualHost> block:

Alias /mediawiki /var/www/html/mediawiki
<Directory /var/www/html/mediawiki>
    Options +FollowSymLinks
    AllowOverride All
</Directory>

Save and close the file.

Enable the necessary Apache modules:

sudo a2enmod rewrite
sudo systemctl restart apache2

6. Complete Installation

Visit http://your-server-ip/mediawiki in your web browser. If everything was done correctly, you should see the MediaWiki homepage.

Congratulations, you have successfully installed MediaWiki on your POP! OS system!

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!