MediaWiki is an open-source platform used to power Wikipedia and many other wiki-based websites. It is ideal for creating collaborative knowledge bases and is widely used by organizations, schools, and communities. In this guide, we’ll show you how to install MediaWiki on Debian 12. Hosting your MediaWiki site on a WindowsVPS is highly recommended, as a VPS server provides the scalability and performance needed for a smooth wiki experience.
Step 1: Update Your VPS Server
Before you begin the installation, it’s important to ensure your VPS server is up to date. Run the following commands to update your Debian 12 system:
sudo apt update && sudo apt upgrade -y
By using a WindowsVPS, you can ensure that your MediaWiki platform runs on a secure and optimized VPS server that is capable of handling growing traffic and data.
Step 2: Install Apache, MySQL, and PHP (LAMP Stack)
MediaWiki requires a LAMP stack (Linux, Apache, MySQL, PHP). Begin by installing Apache, MySQL, and PHP:
- Install Apache:
sudo apt install apache2 -y
- Start and enable Apache to start on boot:
sudo systemctl enable apache2 --now
- Install MySQL:
sudo apt install mysql-server -y
- Secure the MySQL installation:
sudo mysql_secure_installation
- Install PHP along with necessary extensions for MediaWiki:
sudo apt install php php-mysql php-xml php-mbstring php-intl php-gd php-json php-cli php-curl php-zip -y
Step 3: Create a MySQL Database for MediaWiki
MediaWiki requires a database to store its content. Log in to MySQL and create a database and user for MediaWiki:
sudo mysql -u root -p
Once logged in, create the database and user with the following commands:
CREATE DATABASE mediawiki;
CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON mediawiki.* TO 'wikiuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Make sure to replace your_password
with a secure password of your choice.
Step 4: Download and Install MediaWiki
Now, download the latest version of MediaWiki from the official website. First, navigate to the /var/www/html
directory:
cd /var/www/html
Download MediaWiki using wget
:
wget https://releases.wikimedia.org/mediawiki/1.39/mediawiki-1.39.1.tar.gz
Extract the downloaded file:
tar -xvzf mediawiki-1.39.1.tar.gz
Move the extracted files to a new directory for your MediaWiki site:
sudo mv mediawiki-1.39.1/ mediawiki
Step 5: Set File Permissions
Set the appropriate ownership and permissions for the MediaWiki directory:
sudo chown -R www-data:www-data /var/www/html/mediawiki
sudo chmod -R 755 /var/www/html/mediawiki
Step 6: Configure Apache for MediaWiki
Create a new Apache virtual host file for MediaWiki:
sudo nano /etc/apache2/sites-available/mediawiki.conf
Add the following configuration:
ServerAdmin admin@your-domain.com
DocumentRoot /var/www/html/mediawiki
ServerName your-domain.com
AllowOverride All
Require all granted
ErrorLog ${APACHE_LOG_DIR}/mediawiki-error.log
CustomLog ${APACHE_LOG_DIR}/mediawiki-access.log combined
Replace your-domain.com
with your actual domain name. Then, enable the site and the Apache rewrite module:
sudo a2ensite mediawiki.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Step 7: Complete MediaWiki Setup
Now that MediaWiki is installed, open your browser and navigate to http://your-domain.com
. You will be taken to the MediaWiki setup page. Follow the instructions to configure your database connection (using the database and user you created earlier), set up the admin account, and complete the installation.
Once the setup is complete, download the generated LocalSettings.php
file and upload it to the /var/www/html/mediawiki
directory to finalize your MediaWiki installation.
Step 8: Optimize MediaWiki with a VPS Server
MediaWiki can grow rapidly as more content is added and more users collaborate. Hosting your MediaWiki platform on a WindowsVPS ensures that your site remains fast, secure, and scalable. A VPS server provides dedicated resources, giving your wiki platform the ability to handle high traffic and large amounts of content.
Conclusion
Installing MediaWiki on Debian 12 is a straightforward process that allows you to create a powerful and flexible wiki platform for knowledge sharing. For better performance, scalability, and control, consider hosting your MediaWiki site on a WindowsVPS. A reliable VPS server ensures that your wiki will operate smoothly, even as your content and user base grow.
For more information on VPS hosting and how to optimize your server for MediaWiki, visit WindowsVPS today.