MediaWiki is a free and open-source wiki software platform that is used by millions of websites, including Wikipedia. MediaWiki allows users to easily create and edit web pages using a simple markup language, and it provides a range of features for managing and organizing content, including support for media files, templates, and extensions.
In this tutorial, we will show you how to install and configure MediaWiki on Ubuntu 22.04. We will be using Apache as the web server and MySQL as the database server for MediaWiki.
Prerequisites
Before you begin, you will need the following:
- A system running Ubuntu 22.04
 - A user account with 
sudoprivileges - Apache and MySQL installed and configured on your system.
 
Installing MediaWiki
To install MediaWiki on Ubuntu 22.04, we first need to update the package index and install the mediawiki package. This package provides the core MediaWiki software and the necessary dependencies.
To update the package index and install the mediawiki package, use the following command:
sudo apt update
sudo apt install mediawiki
After the package is installed, we need to configure Apache to serve the MediaWiki files. To do this, we will create a new Apache virtual host configuration file for MediaWiki.
First, create a new file called mediawiki.conf in the /etc/apache2/sites-available directory with the following content:
<VirtualHost *:80>
  ServerName wikiserver.example.com
  DocumentRoot /var/lib/mediawiki
  <Directory /var/lib/mediawiki>
    Options +FollowSymLinks
    AllowOverride All
  </Directory>
  ErrorLog ${APACHE_LOG_DIR}/mediawiki-error.log
  CustomLog ${APACHE_LOG_DIR}/mediawiki-access.log combined
</VirtualHost>
Replace wikiserver.example.com with the hostname or IP address of your MediaWiki server. This configuration file defines a new virtual host that listens on port 80, and sets the document root for MediaWiki to /var/lib/mediawiki. It also enables the FollowSymLinks and AllowOverride options for the MediaWiki directory, and sets up log files for the virtual host.
After you have created the mediawiki.conf file, enable the new virtual host and disable the default virtual host by running the following commands:
sudo a2ensite mediawiki.conf
Now that Apache is configured to serve the MediaWiki files, we need to create a database and user for MediaWiki to use. We will do this using the mysql command-line client.
First, log in to the MySQL server as the root user:
Copy code
mysql -u root -p
Then, create a new database and user for MediaWiki by running the following commands in the mysql shell:
Copy code
CREATE DATABASE wikidb;
GRANT ALL PRIVILEGES ON wikidb.* TO 'wikiuser'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
Replace wikidb with the name of the database, wikiuser with the username of the user, and password with a password for the user. This will create a new database called wikidb and a new user called wikiuser with the specified password. The user will have full privileges on the wikidb database.
After you have created the database and user, exit the mysql shell by running the exit command.
Next, we need to run the MediaWiki setup script to configure the software and create the necessary tables in the database. To do this, open a web browser and navigate to the URL of your MediaWiki server. You should see the MediaWiki setup page.
Follow the prompts on the setup page to configure MediaWiki. You will be asked to provide the database name, username, and password that you created earlier, as well as the language and name for your wiki.
After you have completed the setup, MediaWiki will be installed and configured on your system. You can now start using MediaWiki to create and edit pages on your wiki.
In conclusion, installing and configuring MediaWiki on Ubuntu 22.04 is a straightforward process. By following the steps in this tutorial, you can quickly set up a MediaWiki server and start using it to create and manage your own wiki.