Linux Server Setup
- Linux Server Setup
This article provides a comprehensive guide to setting up a Linux server suitable for hosting a MediaWiki installation. It's geared towards newcomers to server administration and aims to cover essential steps from initial server provisioning to basic security hardening. This guide assumes you have basic familiarity with the command line.
1. Server Provisioning and Operating System Choice
Choosing the right Linux distribution is the first step. Popular choices include Ubuntu Server, Debian, CentOS, and Rocky Linux. For simplicity and widespread community support, we'll focus on Ubuntu Server 22.04 LTS as an example throughout this guide.
Recommended Server Specifications
The following table outlines recommended hardware specifications based on expected wiki traffic:
CPU | RAM | Storage | Expected Traffic |
---|---|---|---|
2 Cores | 4 GB | 80 GB SSD | Low (Under 50 concurrent users) |
4 Cores | 8 GB | 160 GB SSD | Medium (50-200 concurrent users) |
8+ Cores | 16+ GB | 500+ GB SSD | High (200+ concurrent users) |
These are estimates; requirements may vary based on the complexity of your wiki (extensions, images, etc.).
2. Initial Server Configuration
After provisioning your server (through a provider like DigitalOcean, AWS, or Linode), the first steps involve updating packages and creating a new user account.
Initial System Updates
After logging in via SSH, run the following commands:
sudo apt update sudo apt upgrade
This ensures your system has the latest security patches and software versions.
Creating a New User Account
It's crucial *not* to run services like MediaWiki as the root user. Create a dedicated user account:
sudo adduser mediawiki sudo usermod -aG sudo mediawiki
Log out and log back in as the `mediawiki` user.
3. Installing Essential Software
MediaWiki requires several software packages to function correctly. These include a web server, a database server, and PHP.
Required Software Stack
The following table details the necessary software:
Software | Version (Example) | Purpose |
---|---|---|
Apache2 | 2.4 | Web Server |
MariaDB | 10.6 | Database Server |
PHP | 8.1 | Server-side scripting language |
Composer | 2.x | Dependency Management for PHP |
Installation Commands (Ubuntu 22.04)
sudo apt install apache2 mariadb-server php php-cli php-mysql php-gd php-curl php-mbstring php-xml php-zip composer
4. Database Setup
MariaDB needs to be configured to store MediaWiki's data.
Securing MariaDB
Run the `mysql_secure_installation` script:
sudo mysql_secure_installation
Follow the prompts to set a root password, remove anonymous users, disallow remote root login, and remove the test database.
Creating the MediaWiki Database
Log into the MariaDB shell:
sudo mysql -u root -p
Then, execute the following SQL commands:
CREATE DATABASE wikidb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'your_strong_password'; GRANT ALL PRIVILEGES ON wikidb.* TO 'wikiuser'@'localhost'; FLUSH PRIVILEGES; EXIT;
Replace `'your_strong_password'` with a strong, unique password.
5. Web Server Configuration (Apache2)
Apache2 needs to be configured to serve the MediaWiki files.
Enabling Required Apache Modules
sudo a2enmod rewrite headers sudo systemctl restart apache2
Creating an Apache Virtual Host
Create a new virtual host configuration file (e.g., `/etc/apache2/sites-available/mediawiki.conf`):
```apache <VirtualHost *:80>
ServerName your.wiki.domain DocumentRoot /var/www/mediawiki
<Directory /var/www/mediawiki> Options FollowSymLinks AllowOverride All Require all granted </Directory>
ErrorLog ${APACHE_LOG_DIR}/mediawiki_error.log CustomLog ${APACHE_LOG_DIR}/mediawiki_access.log combined
</VirtualHost> ```
Replace `your.wiki.domain` with your actual domain name. Enable the site and restart Apache:
sudo a2ensite mediawiki.conf sudo systemctl restart apache2
6. Downloading and Installing MediaWiki
Download the latest stable release of MediaWiki from the official website. Extract the archive to `/var/www/mediawiki`.
Setting File Permissions
sudo chown -R www-data:www-data /var/www/mediawiki sudo chmod -R 755 /var/www/mediawiki
7. Running the MediaWiki Installation =
Navigate to your wiki's domain in a web browser. The MediaWiki installer will guide you through the remaining steps, including database configuration (using the credentials created earlier). Follow the onscreen instructions to complete the installation. Refer to the MediaWiki documentation for detailed guidance on the installation process.
8. Security Hardening
After installation, consider these security measures:
Firewall Configuration (UFW)
sudo ufw allow 80 sudo ufw allow 443 # If using HTTPS sudo ufw enable
Regular Backups
Implement a regular backup strategy for your database and MediaWiki files. Consider using tools like rsync or dedicated backup solutions.
Keeping Software Updated
Regularly update your operating system and all installed software (Apache, MariaDB, PHP) to patch security vulnerabilities. See section 2 for update commands.
Help:Contents
Manual:Configuration
MediaWiki
Apache HTTP Server
MariaDB
PHP
Server Administration
Security
Ubuntu Server
Debian
CentOS
Rocky Linux
DigitalOcean
AWS
Linode
File:Example.png (Placeholder - do not actually include an image)
Special:MyPreferences
Main Page
Help:Starting a wiki
Manual:Upgrading
Manual:Configuration
Extension:Semantic MediaWiki (Example extension)
Intel-Based Server Configurations
Configuration | Specifications | Benchmark |
---|---|---|
Core i7-6700K/7700 Server | 64 GB DDR4, NVMe SSD 2 x 512 GB | CPU Benchmark: 8046 |
Core i7-8700 Server | 64 GB DDR4, NVMe SSD 2x1 TB | CPU Benchmark: 13124 |
Core i9-9900K Server | 128 GB DDR4, NVMe SSD 2 x 1 TB | CPU Benchmark: 49969 |
Core i9-13900 Server (64GB) | 64 GB RAM, 2x2 TB NVMe SSD | |
Core i9-13900 Server (128GB) | 128 GB RAM, 2x2 TB NVMe SSD | |
Core i5-13500 Server (64GB) | 64 GB RAM, 2x500 GB NVMe SSD | |
Core i5-13500 Server (128GB) | 128 GB RAM, 2x500 GB NVMe SSD | |
Core i5-13500 Workstation | 64 GB DDR5 RAM, 2 NVMe SSD, NVIDIA RTX 4000 |
AMD-Based Server Configurations
Configuration | Specifications | Benchmark |
---|---|---|
Ryzen 5 3600 Server | 64 GB RAM, 2x480 GB NVMe | CPU Benchmark: 17849 |
Ryzen 7 7700 Server | 64 GB DDR5 RAM, 2x1 TB NVMe | CPU Benchmark: 35224 |
Ryzen 9 5950X Server | 128 GB RAM, 2x4 TB NVMe | CPU Benchmark: 46045 |
Ryzen 9 7950X Server | 128 GB DDR5 ECC, 2x2 TB NVMe | CPU Benchmark: 63561 |
EPYC 7502P Server (128GB/1TB) | 128 GB RAM, 1 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (128GB/2TB) | 128 GB RAM, 2 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (128GB/4TB) | 128 GB RAM, 2x2 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (256GB/1TB) | 256 GB RAM, 1 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (256GB/4TB) | 256 GB RAM, 2x2 TB NVMe | CPU Benchmark: 48021 |
EPYC 9454P Server | 256 GB RAM, 2x2 TB NVMe |
Order Your Dedicated Server
Configure and order your ideal server configuration
Need Assistance?
- Telegram: @powervps Servers at a discounted price
⚠️ *Note: All benchmark scores are approximate and may vary based on configuration. Server availability subject to stock.* ⚠️