How to Install MediaWiki on Ubuntu Server

Step 1: Update System

First and foremost, let's update our system with the following command:

sudo apt-get update

Step 2: Install LAMP Server

The next step is to install LAMP (Linux, Apache, MySQL, and PHP) server. You can install it using the following command:

sudo apt-get install apache2 mysql-server php7.2 libapache2-mod-php7.2 php7.2-mysql php7.2-xml

Step 3: Create a Database

Next, create a database where MediaWiki can store its data. You can do this by running the following command:

sudo mysql -u root -p

CREATE DATABASE mediawiki;

CREATE USER 'mediawiki'@'localhost' IDENTIFIED BY 'YourPassword';

GRANT ALL PRIVILEGES ON mediawiki.* TO 'mediawiki'@'localhost';

FLUSH PRIVILEGES;

Replace 'YourPassword' with a strong password of your choice.

Step 4: Download and Install MediaWiki

Now we need to download and install the MediaWiki software. Follow these steps:

cd /var/www/html

sudo wget https://releases.wikimedia.org/mediawiki/1.xx/mediawiki-1.xx.x.tar.gz

Note: Replace "1.xx" with the latest stable version number of MediaWiki.

sudo tar -xvzf mediawiki-1.xx.x.tar.gz

sudo mv mediawiki-1.xx.x/ mediawiki/

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

Step 5: Configure MediaWiki

Now we need to configure MediaWiki, which can be done by accessing it through a web browser.

Open your web browser and navigate to your server's IP address, followed by "/mediawiki". For example:

http://your-server-ip/mediawiki

You will see the MediaWiki installer screen. Follow the prompts to set up your wiki, including specifying the database settings you created earlier.

Step 6: Complete the Installation

After filling in all the necessary fields on the installer page, click on the "Install MediaWiki" button.

Once the installation is complete, you will be prompted to download a LocalSettings.php file. Download this file and place it in the root directory of your MediaWiki installation.

Conclusion

Congratulations! You have successfully installed MediaWiki on your Ubuntu server. You can now access your wiki by navigating to the IP address of your server in a web browser.

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!