How to Set Up a Test Environment on a Rented Server

From Server rental store
Jump to navigation Jump to search

---

  1. How to Set Up a Test Environment on a Rented Server

This article details the steps required to set up a test environment for MediaWiki on a rented server. This is crucial for safely testing extensions, themes, and configuration changes before implementing them on a live, production wiki. We will cover server requirements, software installation, MediaWiki installation, and basic configuration. This guide assumes you have basic familiarity with the command line and server administration.

1. Server Requirements and Selection

Choosing the right server is essential. The specifications will depend on the size and expected traffic of your test wiki, but here are some minimum recommendations.

Specification Minimum Requirement Recommended
CPU 1 vCPU 2 vCPU
RAM 1 GB 2 GB
Disk Space 20 GB 40 GB (SSD preferred)
Operating System Ubuntu 20.04 LTS Ubuntu 22.04 LTS

Popular providers include DigitalOcean, Linode, Vultr, and Amazon EC2. Consider the cost, data center location (closer to your users is better), and scalability options when making your decision. Ensure the server offers SSH access for remote administration. A clean operating system installation is highly recommended.

2. Software Installation

Once you have access to your server, you need to install the necessary software: a web server (Apache or Nginx), PHP, and a database server (MySQL/MariaDB or PostgreSQL). We will use Apache, PHP, and MariaDB as an example.

2.1 Apache Installation

```bash sudo apt update sudo apt install apache2 sudo systemctl start apache2 sudo systemctl enable apache2 ```

2.2 PHP Installation

Ensure you install the necessary PHP modules for MediaWiki.

```bash sudo apt install php libapache2-mod-php php-mysql php-gd php-curl php-mbstring php-xml php-zip php-intl php-bcmath ```

2.3 MariaDB Installation

```bash sudo apt install mariadb-server sudo systemctl start mariadb sudo systemctl enable mariadb sudo mysql_secure_installation ```

Follow the prompts from `mysql_secure_installation` to set a root password and improve security.

3. MediaWiki Installation

3.1 Downloading MediaWiki

Download the latest stable version of MediaWiki from the MediaWiki download page. Use `wget` on your server:

```bash wget https://releases.wikimedia.org/mediawiki/1.40/mediawiki-1.40.0.tar.gz tar -xzf mediawiki-1.40.0.tar.gz sudo mv mediawiki-1.40.0 /var/www/html/mediawiki sudo chown -R www-data:www-data /var/www/html/mediawiki ```

3.2 Creating a Database

Log in to MariaDB as the root user:

```bash sudo mysql -u root -p ```

Create a database and user for MediaWiki:

```sql CREATE DATABASE mediawiki; CREATE USER 'mediawiki'@'localhost' IDENTIFIED BY 'your_strong_password'; GRANT ALL PRIVILEGES ON mediawiki.* TO 'mediawiki'@'localhost'; FLUSH PRIVILEGES; EXIT; ```

Replace `'your_strong_password'` with a secure password.

3.3 Running the MediaWiki Installation Script

Navigate to your MediaWiki directory in a web browser: `http://your_server_ip/mediawiki/`. Follow the on-screen instructions. You will need to provide the database information (database name, username, password).

3.4 Configuration Settings

During the installation process, you will be prompted for configuration settings. Pay close attention to `$wgSitename` (the name of your wiki) and `$wgServer`. These settings can be modified later in `LocalSettings.php`. The installer will create a `LocalSettings.php` file, which is the core configuration file for MediaWiki.

4. Basic Configuration and Security

After installation, review the `LocalSettings.php` file. Important settings to consider:

  • `$wgSecretKey`: A randomly generated string used for security. Keep this secret.
  • `$wgCacheDirectory`: The directory where MediaWiki stores cached data.
  • `$wgUploadDirectory`: The directory where uploaded files are stored.

4.1 Apache Virtual Host Configuration

For better security and organization, create a virtual host configuration for your MediaWiki installation. Create a new file in `/etc/apache2/sites-available/`:

```bash sudo nano /etc/apache2/sites-available/mediawiki.conf ```

Add the following content (adjust paths as needed):

```apache <VirtualHost *:80>

   ServerName your_domain_or_ip
   DocumentRoot /var/www/html/mediawiki
   <Directory /var/www/html/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> ```

Enable the virtual host:

```bash sudo a2ensite mediawiki.conf sudo systemctl restart apache2 ```

4.2 Security Considerations

  • **Regular Updates:** Keep MediaWiki, PHP, and the operating system updated to the latest versions to patch security vulnerabilities. See MediaWiki security updates.
  • **Strong Passwords:** Use strong passwords for all user accounts, including the database user.
  • **File Uploads:** Carefully consider the security implications of allowing file uploads. Restrict file types and sizes if necessary. See Managing file uploads.
  • **Firewall:** Configure a firewall to restrict access to your server to only necessary ports.

5. Testing and Further Configuration

After completing these steps, your test environment should be functional. Test the wiki thoroughly by creating and editing pages, installing extensions (see Extension installation), and experimenting with different configurations. Remember to back up your database regularly. Consider setting up a separate user for administrative tasks. Further configuration options are available in the MediaWiki documentation.

Server Specs Summary

Item Detail
Web Server Apache 2.4
PHP Version 8.1 or higher
Database Server MariaDB 10.6 or higher
MediaWiki Version 1.40.0


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?

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