How to Install Mediawiki on Elementary OS Latest

In this tutorial, we will walk through the process of installing Mediawiki on Elementary OS, a user-friendly Linux operating system. Mediawiki is a powerful and popular software platform that enables users to create and manage collaborative wikis, and it can be installed and configured easily on any Linux distribution, including Elementary OS.

Prerequisites

Before we begin, you will need the following:

Step 1: Download and Extract Mediawiki

The first step to install Mediawiki is to download and extract it onto your machine. Here are the steps to follow:

  1. Visit the official Mediawiki website at https://www.mediawiki.org/wiki/MediaWiki and download the latest stable version of Mediawiki.

  2. Once the download is complete, extract the contents of the compressed file to a suitable location on your machine. You can use your preferred archive tool to extract the file, or you can use the command line utility tar to extract the file as follows:

$ tar -xvzf mediawiki-1.35.0.tar.gz

Note that you should replace mediawiki-1.35.0.tar.gz with the actual name of the downloaded file.

Step 2: Create a Database for Mediawiki

Mediawiki requires a database to store its content and configuration information. Here are the steps to create a new database for Mediawiki:

  1. Launch your database management system and log in with administrative privileges.

  2. Create a new database for Mediawiki by running the following command:

CREATE DATABASE mediawiki_db;

Note that you can replace mediawiki_db with any name that you prefer.

  1. Create a new database user and grant it privileges to access the newly created database by running the following commands:
CREATE USER 'wikiuser'@'localhost';
GRANT ALL ON mediawiki_db.* TO 'wikiuser'@'localhost';

Note that you should replace wikiuser with any username that you prefer.

Step 3: Configure Apache or Nginx

Mediawiki requires a web server to serve its pages to end-users. You can use Apache or Nginx as your web server. Here are the steps to configure Apache or Nginx for Mediawiki:

Apache Config

  1. Install the Apache web server on your machine by running the following command:
$ sudo apt-get install apache2
  1. Create a new virtual host configuration file for Mediawiki in the /etc/apache2/sites-available/ directory by running the following command:
$ sudo nano /etc/apache2/sites-available/mediawiki.conf
  1. Add the following lines to the file:
<VirtualHost *:80>
  ServerAdmin admin@example.com
  DocumentRoot /var/www/html/mediawiki
  ServerName wiki.example.com
  ServerAlias www.wiki.example.com
  <Directory /var/www/html/mediawiki/>
    Options FollowSymLinks
    AllowOverride All
  </Directory>
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Note that you should replace admin@example.com, wiki.example.com, and www.wiki.example.com with your actual email and domain names.

  1. Enable the virtual host configuration file by running the following command:
$ sudo a2ensite mediawiki
  1. Restart the Apache web server by running the following command:
$ sudo systemctl restart apache2

Nginx Config

  1. Install the Nginx web server on your machine by running the following command:
$ sudo apt-get install nginx
  1. Create a new virtual host configuration file for Mediawiki in the /etc/nginx/sites-available/ directory by running the following command:
$ sudo nano /etc/nginx/sites-available/mediawiki.conf
  1. Add the following lines to the file:
server {
    listen 80;
    server_name wiki.example.com www.wiki.example.com;

    root /var/www/html/mediawiki;
    index index.php index.html index.htm;

    access_log /var/log/nginx/wiki.example.com.access.log;
    error_log /var/log/nginx/wiki.example.com.error.log;

    client_max_body_size 100M;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
    }

    location /images {
        try_files $uri /mediawiki/index.php;
    }
}

Note that you should replace wiki.example.com and www.wiki.example.com with your actual domain names.

  1. Create a symbolic link to the mediawiki.conf file in the /etc/nginx/sites-enabled/ directory by running the following command:
$ sudo ln -s /etc/nginx/sites-available/mediawiki.conf /etc/nginx/sites-enabled/
  1. Restart the Nginx web server by running the following command:
$ sudo systemctl restart nginx

Step 4: Install Mediawiki

Now that your machine is configured, you can install Mediawiki by following these steps:

  1. Open your web browser and navigate to your wiki domain name, for example, http://wiki.example.com.

  2. You will see the Mediawiki installation page. Follow the installation steps, including setting up the database connection, creating a new administrator account, and configuring the basic settings.

  3. Once the installation is complete, you can log in to your new Mediawiki site and start using it.

Conclusion

In this tutorial, we have seen the steps required to install Mediawiki on Elementary OS. By following these steps, you can set up your own self-hosted wiki platform and use it to manage your collaborative content.

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!