Server rental store

CentOS

# CentOS Server Configuration for MediaWiki

This article provides a guide to configuring a CentOS server to host a MediaWiki 1.40 installation. It is aimed at newcomers to server administration and assumes basic Linux command-line familiarity. We will cover initial server setup, necessary software installation, and basic security considerations. This guide focuses on CentOS 7, as it remains a widely used and supported distribution. While newer versions exist, the core principles apply with minor adjustments.

1. Initial Server Setup

Before installing MediaWiki, a properly configured CentOS server is essential. This includes setting a hostname, configuring networking, and ensuring the system is up-to-date.

1.1 Hostname Configuration

Setting a descriptive hostname makes server identification easier.

1. Edit the `/etc/hostname` file using a text editor like `vi` or `nano`: ``` sudo vi /etc/hostname ``` 2. Replace the current hostname with your desired hostname (e.g., `mediawiki-server`). 3. Edit the `/etc/hosts` file: ``` sudo vi /etc/hosts ``` 4. Ensure the following line is present (replace `mediawiki-server` with your chosen hostname and `your_server_ip` with the server’s actual IP address): ``` your_server_ip mediawiki-server ``` 5. Reboot the server to apply the changes: ``` sudo reboot ```

1.2 System Updates

Keeping your system updated is crucial for security and stability.

``` sudo yum update -y ```

2. Software Installation

MediaWiki requires several software components. We will install these using the `yum` package manager.

2.1 Web Server (Apache)

Apache is a popular web server that will serve the MediaWiki files.

``` sudo yum install httpd -y sudo systemctl start httpd sudo systemctl enable httpd ```

Test Apache by accessing your server’s IP address in a web browser. You should see the Apache test page. For more information on Apache, see [Apache HTTP Server documentation](https://httpd.apache.org/docs/).

2.2 Database Server (MariaDB)

MariaDB is a robust and widely used relational database management system. MediaWiki stores its data in a database.

``` sudo yum install mariadb-server mariadb -y sudo systemctl start mariadb sudo systemctl enable mariadb ```

Secure your MariaDB installation:

``` sudo mysql_secure_installation ```

Follow the prompts to set a root password, remove anonymous users, disallow remote root login, and remove the test database. See the [MariaDB Knowledge Base](https://mariadb.com/kb/) for further details.

2.3 PHP and Required Extensions

PHP is the scripting language MediaWiki is written in. Specific PHP extensions are required for MediaWiki to function correctly.

``` sudo yum install php php-mysql php-gd php-mbstring php-xml php-intl php-zip php-bcmath php-curl -y ```

Restart Apache after installing PHP extensions:

``` sudo systemctl restart httpd ```

Here's a table summarizing the required PHP extensions:

Extension Description
php-mysql Enables PHP to connect to MySQL/MariaDB databases.
php-gd Provides image processing capabilities.
php-mbstring Supports multi-byte string functions.
php-xml Enables PHP to parse XML documents.
php-intl Provides internationalization support.
php-zip Allows PHP to work with ZIP archives.
php-bcmath Offers arbitrary precision mathematics.
php-curl Enables PHP to make HTTP requests.

3. MediaWiki Installation

Now that the prerequisites are met, we can install MediaWiki.

3.1 Downloading MediaWiki

Download the latest stable version of MediaWiki from the [official MediaWiki download page](https://www.mediawiki.org/wiki/Download). Use `wget` to download the file directly to your server:

``` wget https://releases.wikimedia.org/mediawiki/1.40/mediawiki-1.40.0.tar.gz ```

3.2 Extracting and Configuring

1. Extract the downloaded archive: ``` tar -xzf mediawiki-1.40.0.tar.gz ``` 2. Move the extracted directory to the Apache web root (typically `/var/www/html/`): ``` sudo mv mediawiki-1.40.0 /var/www/html/mediawiki ``` 3. Change ownership of the MediaWiki directory to the Apache user (usually `apache`): ``` sudo chown -R apache:apache /var/www/html/mediawiki ``` 4. Navigate to the MediaWiki directory in your web browser (e.g., `http://your_server_ip/mediawiki`). This will start the MediaWiki installation script.

3.3 Database Configuration

Follow the on-screen instructions provided by the MediaWiki installation script. You'll need to provide the following information:

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