Server rental store

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 ServerName yourdomain.com DocumentRoot /var/www/mediawiki

ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined

Options FollowSymLinks AllowOverride All Require all granted ```

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

⚠️ *Note: All benchmark scores are approximate and may vary based on configuration. Server availability subject to stock.* ⚠️