Jump to content

MediaWiki:Installasi on Ubuntu 20.04 (Nginx)

From Wiki
Revision as of 17:54, 30 October 2021 by Kangtain (talk | contribs) (Created page with "MediaWiki is a wiki application written in PHP that the Wikimedia Foundation developed to run several of their projects. The encyclopedia Wikipedia is the most popular of thes...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

MediaWiki is a wiki application written in PHP that the Wikimedia Foundation developed to run several of their projects. The encyclopedia Wikipedia is the most popular of these projects.

A wiki is a type of website that allows its users to create and edit content in a collaborative manner. It can be used in several ways, including as a knowledge base, documentation library, community website, or company intranet.

These kinds of websites are especially useful in contexts where several people need to create and modify pages in a quick and easy way.

This guide will show you how to install and set up the application, giving you the basis to deploy your own wiki site. We will use the domain name “mediawiki.example.com” in this guide. Replace it with the domain name or IP address you have configured on your server.

Prerequisites

  • An Ubuntu 20.04 server. You can run MediaWiki on a different flavor of GNU/Linux, but the steps outlined below could differ.
  • A root password is set up on the server.

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Cloud Server. Create a new server, choosing Ubuntu 20.04 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your Ubuntu 20.04 server, run the following command to update your base system with the latest available packages.

apt-get update -y

Step 2 – Install LAMP Server

  • First, you will need to install the Apache, MariaDB, PHP and other PHP extensions to your server. You can install all of them using the following command:
apt-get install apache2 mariadb-server php libapache2-mod-php php-mbstring php-xml php-json php-mysql php-curl php-intl php-gd php-mbstring texlive imagemagick unzip -y
  • Once all the packages are installed, you can proceed to create a database.

Step 3 – Create a Database

  • Next, login to the MariaDB shell with the following command:
mysql
  • Once you are login, create a database and user for MediaWiki with the following command:
CREATE DATABASE mediawiki;

GRANT ALL PRIVILEGES ON mediawiki.* TO 'wikiuser'@'localhost' IDENTIFIED BY 'password';
  • Next, flush the privileges and exit from the MariaDB with the following command:
flush privileges;
exit;
  • At this point, your MariaDB database is created.

Step 4 – Download MediaWiki

  • Next, you will need to download the latest version of MediaWiki to the Apache web root directory. You can download it with the following command:
wget https://releases.wikimedia.org/mediawiki/1.36/mediawiki-1.36.2.zip
  • Once the download is completed, unzip the downloaded file with the following command:
unzip mediawiki-1.36.2.zip
  • Next, move the extracted directory to the Apache web root directory:
mv mediawiki-1.36.2 /var/www/html/mediawiki
  • Next, you will need to install Composer in your system. You can install it with the following command:
apt-get install composer -y
  • Once the Composer is installed, change the directory to the MediaWiki and install all PHP dependencies using the following command:
cd /var/www/html/mediawiki
composer install --no-dev
  • Once all the dependencies are installed, set proper permission to the MediaWiki with the following command:
chown -R www-data:www-data /var/www/html/mediawiki

Step 5 – Configure Apache for MediaWiki

  • Next, create an Apache virtual host configuration file for MediaWiki with the following command:
nano /etc/apache2/sites-available/mediawiki.conf
  • Add the following lines:
<VirtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot /var/www/html/mediawiki/
    ServerName mediawiki.example.com

    <Directory /var/www/html/mediawiki/>
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/apache2/mediawiki_error
    CustomLog /var/log/apache2/mediawiki_access common
</VirtualHost>
  • Save and close the file then enable the virtual host file and restart the Apache service with the following command:
a2ensite mediawiki.conf
systemctl reload apache2

Source