Jump to content

Setting up Wiki locally: Difference between revisions

From WIKI FOSSCELL NITC
Tags: Mobile edit Mobile web edit
Docker: Fixed content
Tags: Mobile edit Mobile web edit
 
Line 36: Line 36:


==Docker==
==Docker==
<b>This method is not advised for those who are trying to install mediawiki for the first time. This is purely for knowledge and doesnt include installation steps</b> <br>
<b>This method is not advised for those who are trying to install Mediawiki for the first time. This is purely for knowledge and doesn't include installation steps</b> <br>
You must have understood the hassle of downloading a software and configuring the files. Now imagine the case of a larger software. It will be huge task to scale up the software to a different server as you will have to manually install all the packages and make sure that the versions are indeed correct.  
You must have understood the hassle of downloading a software and configuring the files. Now imagine the case of a larger software. It will be huge task to scale up the software to a different server as you will have to manually install all the packages and make sure that the versions are indeed correct.  
<br>
<br>

Latest revision as of 10:17, 17 August 2024

This page explains how to install MediaWiki on Ubuntu. There are several methods and we shall go through them one by one.

Before installing anything, it is advised to run sudo apt update to make sure that all the packages are up to date.

Manual Installation

We require a web server to install Mediawiki, preferably Nginx or Apache. The primary function of a web server is to host websites and deliver information or webpages to end user. There is no definitive answer regarding superiority, as both have their own merits and demerits.

Apache2

  • Install Apache2, MySQL and PHP packages using this command.
sudo apt-get install apache2 mariadb-server php php-mysql libapache2-mod-php php-xml php-mbstring


Mediawiki supports multiple databases like Postgresql, but we will be focusing on Mariadb, which is essentially a modified version of MySQL.

  • Install Mediawiki

https://www.mediawiki.org/wiki/Download

  • Go to the downloads directory and extract the file
tar -xvzf /tmp/mediawiki-*.tar.gz
  • Create a mediawiki directory and the move the extracted files to the new directory
sudo mkdir /var/www/html/mediawiki
sudo mv mediawiki-*/* /var/www/html/mediawiki
  • Configure MySQL
sudo mysql -u root -p
CREATE USER 'new_mysql_user'@'localhost' IDENTIFIED BY 'THISpasswordSHOULDbeCHANGED';
quit;
sudo mysql -u root -p
CREATE DATABASE my_wiki;
use my_wiki;
GRANT ALL ON my_wiki.* TO 'new_mysql_user'@'localhost';
commit;
quit;
  • Try to access https://localhost/mediawiki and follow the instructions to download LocalSettings.php which is used to change appearance and functionalities (extensions) of your new personal Wiki.
cd /Downloads
mv LocalSettings.php /var/www/html/mediawiki

And congratulations, you have successfully set up mediawiki on your local machine. Mess around with extensions and themes to delve into the technical aspect.

Nginx

Docker

This method is not advised for those who are trying to install Mediawiki for the first time. This is purely for knowledge and doesn't include installation steps
You must have understood the hassle of downloading a software and configuring the files. Now imagine the case of a larger software. It will be huge task to scale up the software to a different server as you will have to manually install all the packages and make sure that the versions are indeed correct.
This where containerization acts as a game changer. A containerization tool basically packs up all the required dependencies and files into a single container, and all you have to do is activate the container to run your application, almost like a little isolated environment running on your machine that has all the required stuff included, sounds too good right?. Lets get into the basics.

  • Docker Image - It is an executable package of software that includes everything needed to run an application. They include code, libraries and everything required for your software. Think of it like a dish recipe. You can create your own image using a DockerFile using a base image like alpine, or you could check for a prebuilt one on https://hub.docker.com/.
  • Docker Container - It is a running instance of an image, almost like dish prepared using the recipe. In formal terms, each container is an isolated environment where the application runs.
  • Since an application may require multiple services, just like wiki requires mediawiki, nginx/apache2 and mariadb, we can activate multiple containers using Docker Compose file (docker-compose.yml).

Feel free to check it out as it is a skill that is worth learning.