Google Cloud Platform
- Google Cloud Platform Server Configuration for MediaWiki 1.40
This article details configuring a server environment for running MediaWiki 1.40 on Google Cloud Platform (GCP). It is aimed at newcomers to both GCP and MediaWiki server administration. We will cover instance selection, database setup, and essential software installation.
1. Instance Selection & Initial Setup
Choosing the appropriate Google Compute Engine instance is crucial for performance. Consider your expected traffic and data size. For a small to medium-sized wiki, a general-purpose machine type is usually sufficient. For large, high-traffic wikis, consider compute-optimized or memory-optimized instances.
Machine Type | vCPUs | Memory (GB) | Estimated Monthly Cost (USD) | Use Case |
---|---|---|---|---|
e2-medium | 2 | 4 | $25 - $35 | Small Wiki (under 1000 pages, low traffic) |
e2-standard-4 | 4 | 16 | $60 - $80 | Medium Wiki (1000-10,000 pages, moderate traffic) |
n2-standard-8 | 8 | 32 | $120 - $160 | Large Wiki (10,000+ pages, high traffic) |
Once you've selected a machine type, create a Compute Engine instance. Choose a suitable Operating System – Debian or Ubuntu Server are recommended for their stability and package availability. During instance creation, ensure you allow HTTP and HTTPS traffic through the firewall. Consider using a Static IP Address for consistent access to your wiki. Finally, use SSH to connect to your instance.
2. Database Configuration (MySQL/MariaDB)
MediaWiki requires a database to store its data. We'll use either MySQL or MariaDB, which can be installed directly on the Compute Engine instance or as a separate Cloud SQL instance. Using Cloud SQL offers managed backups and scaling.
2.1. Installing MariaDB on the Compute Engine Instance
If you choose to install MariaDB directly on the instance:
1. Update the package list: `sudo apt update` 2. Install MariaDB server: `sudo apt install mariadb-server` 3. Secure the MariaDB installation: `sudo mysql_secure_installation` (follow the prompts to set a root password and remove anonymous users)
2.2. Creating the MediaWiki Database
After installation, log in to the MariaDB shell: `sudo mysql -u root -p`. Then, create a database and user for MediaWiki:
```sql 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 secure password. This database and user will be used by MediaWiki. See Database Setup for more details.
3. Software Installation and Configuration
Install the necessary software packages: PHP, Apache, and any required PHP extensions.
1. Update the package list: `sudo apt update` 2. Install Apache: `sudo apt install apache2` 3. Install PHP and necessary extensions: `sudo apt install php libapache2-mod-php php-mysql php-gd php-curl php-mbstring php-xml php-intl php-bcmath php-zip`
Next, configure Apache to serve MediaWiki. Create a virtual host configuration file (e.g., `/etc/apache2/sites-available/mediawiki.conf`):
```apache <VirtualHost *:80>
ServerName yourdomain.com DocumentRoot /var/www/mediawiki
ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/mediawiki> Options FollowSymLinks AllowOverride All Require all granted </Directory>
</VirtualHost> ```
Replace `yourdomain.com` with your actual domain name. Enable the virtual host: `sudo a2ensite mediawiki.conf` and restart Apache: `sudo systemctl restart apache2`. See Apache Configuration for further details.
4. Downloading and Installing MediaWiki
Download the latest stable version of MediaWiki 1.40 from the MediaWiki Download Page. Extract the downloaded archive to `/var/www/mediawiki`.
1. Change ownership of the MediaWiki directory: `sudo chown -R www-data:www-data /var/www/mediawiki` 2. Navigate to your wiki's URL in a web browser. The MediaWiki installation script will guide you through the remaining steps, including database configuration using the credentials created earlier.
5. Security Considerations
- **HTTPS:** Enable HTTPS using Let's Encrypt or a similar service. This is critical for protecting user data and preventing eavesdropping. See HTTPS Configuration
- **Regular Updates:** Keep your operating system, Apache, PHP, MariaDB, and MediaWiki software up to date to patch security vulnerabilities.
- **Firewall Rules:** Restrict access to your server using firewall rules. Only allow necessary ports (e.g., 80, 443, 22).
- **Strong Passwords:** Use strong, unique passwords for all user accounts, including the database user. Consider User Account Security best practices.
6. Monitoring and Maintenance
Regularly monitor your server's performance using tools like `top`, `htop`, or Google Cloud Monitoring. Monitor disk space, CPU usage, and memory usage. Implement a regular backup strategy for your database and MediaWiki installation. See Server Monitoring and Backup Strategies.
Monitoring Metric | Recommended Threshold | Action |
---|---|---|
CPU Usage | > 80% | Investigate performance bottlenecks, consider scaling up instance size |
Memory Usage | > 90% | Investigate memory leaks, consider increasing memory or optimizing PHP code |
Disk Space | < 10% Free | Clean up logs, temporary files, or scale up disk size |
Backup Type | Frequency | Method |
---|---|---|
Database Backup | Daily | mysqldump or Cloud SQL backups |
MediaWiki Files | Weekly | rsync or Cloud Storage snapshots |
Full Server Image | Monthly | Google Cloud Snapshots |
Special:Myuser has contributed to this article.
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.* ⚠️