Amazon EC2
- Amazon EC2 Server Configuration for MediaWiki
This article details the configuration of an Amazon Elastic Compute Cloud (EC2) instance for hosting a MediaWiki 1.40 installation. It is aimed at system administrators and newcomers to both AWS and MediaWiki deployment. We will cover instance selection, operating system considerations, and essential software installation.
== Understanding Amazon EC2
Amazon EC2 provides resizable compute capacity in the cloud. It allows you to rent virtual machines (instances) with various operating systems, CPU, memory, storage, and networking capacity. Choosing the right EC2 instance type is crucial for MediaWiki performance. Consider your anticipated user load, the size of your wiki (number of pages, files), and the complexity of your extensions. See Amazon Web Services for more information.
== Instance Type Selection
Selecting the appropriate EC2 instance type depends on your MediaWiki’s scale and requirements. Here's a comparison of common instance families suitable for MediaWiki:
Instance Family | Description | Suitable For |
---|---|---|
t3.medium | General purpose, burstable performance. | Small to medium wikis with moderate traffic. |
m5.large | General purpose, balanced compute, memory, and networking. | Medium to large wikis with consistent traffic. |
r5.large | Memory-optimized, ideal for database-heavy workloads. | Large wikis with extensive use of extensions and complex searches. |
c5.large | Compute-optimized, best for CPU-intensive tasks. | Wikis with heavy image processing or complex templates. |
It is recommended to start with a `t3.medium` instance and scale up as needed. Monitoring your server’s CPU usage, memory consumption, and disk I/O is essential for determining when to upgrade. Refer to the Server Monitoring article for details.
== Operating System and Initial Configuration
We recommend using Amazon Linux 2 or Ubuntu Server 22.04 LTS for your MediaWiki server. These distributions are well-supported and offer good performance.
- **Amazon Linux 2:** Provides tight integration with AWS services and is optimized for EC2. See Amazon Linux for documentation.
- **Ubuntu Server 22.04 LTS:** A popular and versatile distribution with a large community and extensive documentation. See Ubuntu Server for documentation.
After launching your EC2 instance, perform the following initial configuration steps:
1. **Update the system:** `sudo yum update` (Amazon Linux) or `sudo apt update && sudo apt upgrade` (Ubuntu). Refer to System Updates for more information. 2. **Configure the firewall:** Allow inbound traffic on ports 80 (HTTP) and 443 (HTTPS). See Firewall Configuration for details. 3. **Set up SSH access:** Secure your server by configuring SSH access with key pairs. Refer to SSH Security for best practices.
== Software Installation
The following software is required to run MediaWiki:
- **Web Server:** Apache or Nginx. We recommend Apache for its ease of configuration with MediaWiki. See Apache Web Server for configuration details.
- **PHP:** Version 7.4 or higher. Ensure you install the necessary PHP modules (see below). See PHP Installation for instructions.
- **MySQL/MariaDB:** A relational database to store MediaWiki’s data. MariaDB is a popular and highly compatible alternative to MySQL. See Database Setup for details.
Here’s a table outlining the required PHP modules:
PHP Module | Description | - | php-mysql | Allows PHP to connect to MySQL/MariaDB databases. |
---|---|---|---|---|
php-gd | Enables image manipulation. | |||
php-mbstring | Provides support for multi-byte strings. | |||
php-xml | Enables XML parsing and processing. | |||
php-curl | Allows PHP to make HTTP requests. | |||
php-json | Enables JSON encoding and decoding. |
Install these modules using your distribution’s package manager. For example, on Ubuntu: `sudo apt install php-mysql php-gd php-mbstring php-xml php-curl php-json`.
== MediaWiki Installation
1. **Download MediaWiki:** Download the latest stable release from the MediaWiki Download Page. 2. **Extract the archive:** Extract the downloaded archive to your web server’s document root (e.g., `/var/www/html/`). 3. **Configure the database:** Create a database and user in MySQL/MariaDB and grant the necessary privileges. See Database Configuration for specifics. 4. **Run the MediaWiki installer:** Access your MediaWiki installation through your web browser and follow the on-screen instructions. The installer will guide you through configuring the database connection and setting up your initial administrator account. 5. **Configure `LocalSettings.php`:** Adjust the `LocalSettings.php` file to customize your MediaWiki installation. Pay close attention to the `$wgServer` and `$wgScriptPath` settings. See LocalSettings.php Configuration.
== Security Considerations
- **Regular Security Updates:** Keep your operating system and all installed software up to date with the latest security patches. See Security Updates for guidance.
- **HTTPS:** Enable HTTPS to encrypt communication between your server and users. Use Let's Encrypt for free SSL/TLS certificates. See HTTPS Configuration.
- **Database Security:** Secure your database server by using strong passwords, limiting access, and regularly backing up your data. See Database Security.
- **File Uploads:** Carefully consider the security implications of allowing file uploads. Restrict file types and sizes to mitigate potential risks. See File Upload Security.
== Performance Tuning
Here is a table of common performance tuning settings:
Setting | Description | Recommendation |
---|---|---|
`$wgMainCacheType` | Caching mechanism for page rendering. | `redis` (if Redis is installed) or `memcached`. |
`$wgParserCacheType` | Caching mechanism for parser output. | `redis` or `memcached`. |
`$wgJobRunLimit` | Maximum number of jobs to run in a single cycle. | Increase this value if you have a multi-core server. |
Remember to monitor your server’s performance and adjust these settings accordingly. See Performance Tuning for more in-depth information.
Apache Web Server
Database Setup
Database Configuration
Database Security
Firewall Configuration
HTTPS Configuration
LocalSettings.php Configuration
PHP Installation
PHP Modules
Security Updates
Server Monitoring
SSH Security
System Updates
Ubuntu Server
Amazon Linux
Amazon Web Services
File Upload Security
Performance Tuning
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.* ⚠️