MediaWiki Installation for Internal Documentation is a common requirement for VPS administrators. This guide provides practical instructions that you can follow on Ubuntu 22.04/24.04 or Debian 12, though most steps apply to other distributions as well.
Prerequisites
- Basic familiarity with the Linux command line
- Root or sudo access to the server
- A database server (MySQL/PostgreSQL)
- A registered domain name (for public-facing services)
Installation Guide
For production deployments, consider implementing high availability by running multiple instances behind a load balancer. This approach provides both redundancy and improved performance under heavy load.
# Install dependencies for CMS
sudo apt update
sudo apt install -y nginx mysql-server php-fpm php-mysql php-xml php-mbstring php-curl php-gd
# Download and install
cd /var/www
sudo wget https://example.com/mediawiki-latest.tar.gz
sudo tar xzf mediawiki-latest.tar.gz
sudo chown -R www-data:www-data /var/www/mediawiki
The configuration above sets the recommended values for a VPS with 2-4GB of RAM. Adjust the memory-related settings proportionally if your server has different specifications.
Database Configuration
Performance benchmarks show that properly tuned mediawiki can handle significantly more concurrent connections than the default configuration. The key improvements come from adjusting worker processes and connection pooling.
# Create database for the CMS
sudo mysql -e "CREATE DATABASE mediawiki_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
sudo mysql -e "CREATE USER 'mediawiki'@'localhost' IDENTIFIED BY 'secure_password';"
sudo mysql -e "GRANT ALL PRIVILEGES ON mediawiki_db.* TO 'mediawiki'@'localhost';"
sudo mysql -e "FLUSH PRIVILEGES;"
Make sure to restart the service after applying these changes. Some settings require a full restart rather than a reload to take effect.
Theme and Plugin Setup
The mediawiki configuration requires careful attention to resource limits and security settings. On a VPS with limited resources, it's important to tune these parameters according to your available RAM and CPU cores.
# Install dependencies for CMS
sudo apt update
sudo apt install -y nginx mysql-server php-fpm php-mysql php-xml php-mbstring php-curl php-gd
# Download and install
cd /var/www
sudo wget https://example.com/mediawiki-latest.tar.gz
sudo tar xzf mediawiki-latest.tar.gz
sudo chown -R www-data:www-data /var/www/mediawiki
Note that file paths may vary depending on your Linux distribution. The examples here are for Debian/Ubuntu; adjust paths accordingly for RHEL/CentOS-based systems.
Important Notes
After applying these changes, monitor the server's resource usage for at least 24 hours to ensure stability. Tools like htop, iostat, and vmstat can provide real-time insights into system performance.
Common Issues and Solutions
- Connection timeout: Verify your firewall rules allow traffic on the required ports. Use
ss -tlnpto confirm the service is listening on the expected port. - Service won't start: Check the logs with
journalctl -xe -u mediawiki. Common causes include port conflicts, missing configuration files, or insufficient permissions.
Wrapping Up
Following this guide, your mediawiki setup should be production-ready. Keep an eye on resource usage as your traffic grows and don't forget to test your backup and recovery procedures periodically.