How to Install Mediawiki on a Ubuntu
If you want to install MediaWiki on Ubuntu, this guide will help you get started. MediaWiki is a free and open-source wiki software package that can be used to create and manage online information. It’s an excellent tool for developing and managing your website or blog.
This is a guide to installing MediaWiki on Ubuntu from scratch. this video shows you how to install all the prereqs, configure the database, PHP settings, and everything to get the Wiki loading in your web browser.

How to Install MediaWiki on Ubuntu: A Detailed Procedure
MediaWiki is a free and open-source software that powers Wikipedia and many other websites. This guide provides a step-by-step procedure for installing MediaWiki on an Ubuntu server. The guide assumes that you have a basic understanding of Linux commands and have sudo privileges on the server.
Pre-requisites
- Ubuntu Server: A running instance of Ubuntu (18.04 or later is recommended).
- SSH Access: Secure Shell (SSH) access to your Ubuntu server.
- LAMP Stack: Linux, Apache, MySQL, and PHP installed on your server.
Step 1: Update Ubuntu Packages
Firstly, update the package list and upgrade the installed packages to their latest versions.
sudo apt update sudo apt upgrade
Step 2: Install Apache Web Server
If Apache is not already installed, you can install it using the following command:
sudo apt install apache2
Step 3: Install MySQL Database Server
Install MySQL by executing the following command:
sudo apt install mysql-server
Step 4: Secure MySQL Installation
Run the MySQL security script to secure your database.
sudo mysql_secure_installation
Follow the prompts to set a root password and secure your MySQL installation.
Step 5: Install PHP
MediaWiki requires PHP to function. Install PHP and some additional modules with the following command:
sudo apt install php php-mysql php-xml php-mbstring
Step 6: Download MediaWiki
Navigate to the web root directory and download the latest version of MediaWiki.
cd /var/www/html wget https://releases.wikimedia.org/mediawiki/1.35/mediawiki-1.35.0.tar.gz
Step 7: Extract MediaWiki Archive
Extract the downloaded tarball and move the contents to a new directory.
tar xzvf mediawiki-*.tar.gz mv mediawiki-1.35.0/* /var/www/html/
Step 8: Create a MySQL Database
Log in to MySQL and create a new database for MediaWiki.
mysql -u root -p
CREATE DATABASE mediawiki;
GRANT ALL PRIVILEGES ON mediawiki.* TO 'wikiuser'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;
Step 9: Run MediaWiki Installation Script
Open a web browser and navigate to http://your_server_ip/
. Follow the on-screen instructions to complete the MediaWiki installation.
Step 10: Configure Apache
Finally, configure your Apache server to serve the MediaWiki site. Edit the Apache configuration file as needed.
Advanced Customization and Integration of MediaWiki on Ubuntu
Once you’ve successfully installed MediaWiki on your Ubuntu server, you may want to explore advanced customization options and integration with other software to enhance its capabilities. This guide will walk you through some of these advanced steps.
Customizing MediaWiki Appearance
Install Themes
- Download Theme: Download your desired MediaWiki theme from the MediaWiki Skins directory.
- Upload to Server: Upload the theme folder to
/var/www/html/skins/
on your server. - Edit LocalSettings.php: Open the
LocalSettings.php
file and add the following line to activate the theme:php
wfLoadSkin('YourThemeName');
Customize Logo
- Upload Logo: Upload your custom logo to
/var/www/html/resources/assets/
. - Edit LocalSettings.php: Add the following line to change the logo:php
$wgLogo = "$wgResourceBasePath/resources/assets/your_logo.png";
Extending MediaWiki Functionality
Install Extensions
- Download Extension: Download your desired extension from the MediaWiki Extensions directory.
- Upload to Server: Upload the extension folder to
/var/www/html/extensions/
. - Activate Extension: Open
LocalSettings.php
and add the following line:php
wfLoadExtension('YourExtensionName');
Integration with Other Software
LDAP Integration
- Install LDAP Extension: Follow the steps above to install the LDAP Authentication extension.
- Configure LDAP: Add the LDAP configuration to your
LocalSettings.php
file. This will include the LDAP server details and user credentials.
Visual Editor
- Install Parsoid: Visual Editor requires Parsoid to run. Install it using:bash
sudo apt install parsoid
- Configure Parsoid: Edit the Parsoid settings to point it to your MediaWiki API.
- Activate Visual Editor: Install and activate the Visual Editor extension as described above.
Backup and Restore
Backup
- Backup Database: Use
mysqldump
to backup your MediaWiki database.bash
mysqldump -u root -p mediawiki > mediawiki_backup.sql
Backup Files: Archive the MediaWiki installation directory.
tar czvf mediawiki_files_backup.tar.gz /var/www/html/
Restore
Restore Database: Use mysql
to restore the database
mysql -u root -p mediawiki < mediawiki_backup.sql
Restore Files: Extract the archived files back into the MediaWiki installation directory.
Advanced customization and integration can significantly extend the capabilities of your MediaWiki installation. Whether you’re looking to change the appearance, add new features, or integrate with other platforms, these steps offer a solid foundation.
Recent Comments