Installing MediaWiki on your VPS server running Ubuntu 24.04 is a straightforward process. Follow these steps to get it set up quickly.
Step 1: Update Your System
sudo apt update && sudo apt upgrade -y
Step 2: Install Required Packages
Install the necessary packages for MediaWiki:
sudo apt install apache2 mysql-server php php-mysql php-xml php-mbstring php-zip -y
Step 3: Download MediaWiki
Change to the web directory and download the latest version of MediaWiki:
cd /var/www/html
sudo wget https://releases.wikimedia.org/mediawiki/1.38/mediawiki-1.38.0.tar.gz
sudo tar -xvzf mediawiki-1.38.0.tar.gz
sudo mv mediawiki-1.38.0 mediawiki
Step 4: Configure Apache
Create a new Apache configuration file for MediaWiki:
sudo nano /etc/apache2/sites-available/mediawiki.conf
Insert the following configuration:
<VirtualHost *:80>
DocumentRoot /var/www/html/mediawiki
Enable the new site and the rewrite module:
sudo a2ensite mediawiki
sudo a2enmod rewrite
sudo systemctl restart apache2
Step 5: Create the Database
Log in to MySQL to create a database for MediaWiki:
sudo mysql -u root -p
Then execute the following commands:
CREATE DATABASE wikidb;
CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON wikidb.* TO 'wikiuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 6: Configure MediaWiki
Navigate to the MediaWiki directory and start the installation:
cd /var/www/html/mediawiki
sudo php maintenance/install.php --dbtype=mysql --dbserver=localhost --dbname=wikidb --dbuser=wikiuser --dbpass=your_password --installdb
Step 7: Finalize the Installation
Open your web browser and navigate to:
http://your_server_ip
Follow the on-screen instructions to complete the installation.
Conclusion
By following these steps, you have successfully installed MediaWiki on your VPS server running Ubuntu 24.04. Enjoy your new wiki!