Support Online
Skip to main content

Installing WordPress: Step by Step Guide on CentOS 7

What will you learn in this guide?

In this guide, you will learn how to install WordPress using LAMP architecture on the CentOS 7 operating system.
The entire process is handled, from database preparation to web interface installation.

🧠 Technical Summary

Main Technical Topic:
Installing WordPress with Apache and MariaDB on CentOS 7.

Solved Problem:
Converting an empty Linux server into a working WordPress site.

Steps Followed:

  • Database and user creation
  • Downloading and moving WordPress files
  • Configure file permissions
  • Edit wp-config.php settings
  • Completing the web interface installation

Prerequisites

  • CentOS 7 server
  • user with sudo privilege
  • Installed Apache, MariaDB and PHP

1️⃣ Database and User Preparation

WordPress stores all its content in a database.
First, log in to the MariaDB administration panel:

mysql -u root -p
  • This command connects to the database management system as an administrator.

Create database and user for WordPress:


CREATE DATABASE wordpress;
CREATE USER wordpressuser@localhost IDENTIFIED BY 'guclu_sifre';
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost;
FLUSH PRIVILEGES;
EXIT;
  • These steps create a WordPress-specific database and authorize the user.

2️⃣ Downloading WordPress Files

First install the PHP module required for image processing:


sudo yum install php-gd
  • This module allows WordPress to automatically process images.

  • Restart Apache:

sudo service httpd restart
  • This process activates the new PHP module.

  • Download the current WordPress version:

cd ~
wget http://wordpress.org/latest.tar.gz
  • This command downloads the latest version of WordPress to the server.

  • Extract the files:

tar xzvf latest.tar.gz
  • This process unpacks WordPress files into the folder.

Move to web directory and set permissions:


sudo rsync -avP ~/wordpress/ /var/www/html/
mkdir /var/www/html/wp-content/uploads
sudo chown -R apache:apache /var/www/html/*
  • Files are moved to the web directory and the Apache user is given permissions.

3️⃣ WordPress Configuration

  • Switch to web directory:

cd /var/www/html
  • This directory is the main folder of WordPress.

Create the configuration file:


cp wp-config-sample.php wp-config.php
nano wp-config.php
  • This process creates the WordPress settings file and puts it in edit mode.

Update the following fields:


define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpressuser');
define('DB_PASSWORD', 'guclu_sifre');
  • This information allows WordPress to connect to the database.

4️⃣ Completing the Setup via Web Interface

  1. Go to your server address from the browser:

http://sunucu_ip_adresi_veya_domain
  • Select the language, set the site title and create the administrator account.
  • When the installation is completed, you will be directed to the WordPress administration panel.

❓ Frequently Asked Questions (FAQ)

1. I am getting a database connection cannot be established error. Compare the MariaDB settings with the information in wp-config.php.

2. Why is the php-gd module needed? Without this module, thumbnails cannot be generated automatically.

3. Why did we set file permissions to apache:apache? It is required for WordPress to install plugins and themes.

4. Is this setup sufficient for a production environment? Yes, but SSL and security hardening are recommended.


🚀 Result

WordPress installation on CentOS 7 has been completed successfully. Now you can start producing content. You can try the GenixNode infrastructure immediately for your high-performance projects.