> ## Content Index
> Fetch the complete content index at: https://scriptcrunch.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Installing and Setting up a WordPress on RHEL 7 / CentOS 7
- URL: https://scriptcrunch.com/install-configure-wordpress-rhel/
- Published: 2019-07-03T13:50:08.000Z
- Updated: 2026-06-23T08:56:09.000Z
- Author: Scriptcrunch Editorial
- Tags: Tutorials, Linux, #Migrated-1758801465347, #wp, #wp-post, #Import 2025-09-25 11:57

### Basic Requirements

**Step 1:** Connect to the server using key or user/password

[ssh](https://scriptcrunch.com/ssh-concept/) \-i \~/.ssh/demo.pem [ec2](https://scriptcrunch.com/tag/ec2/)\-user@34.218.66.191

**Step 2:** update yum repo metadata.

sudo yum update -y

**Step 3:** Install wget

sudo yum install -y wget

### Install LAMP (Linux, Apache, MySql \[mariaDB\] and PHP) stack

**Step 1:** Install, start, enable and check the status of Apache web server (httpd)

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

> [Serverpilot WordPress management](https://scriptcrunch.com/recommends/serverpilot/)

**Step 2:** Install and start MariaDB (MySQL)

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

**Step 3:** Configure MariaDB. Enter appropriate values on each prompt.

sudo mysql\_secure\_installation

**Step 4:** Install php, php modules and restart httpd

sudo yum install -y php php-mysql php-gd sudo systemctl restart httpd

**Step 5:** To test php installation, create simple PHP script. Open a test.php file using the following command.

sudo vi /var/www/html/demo.php

**Step 6:** Copy the following php script to the file and save it.

<?php phpinfo(); ?>

**Step 7:** Now, try accessing the demo script using the public IP followed by demo.php as shown below. If every configuration is correct, you will see a web page with all the installed php information.

http://<PUBLIC\_IP>/demo.php

### Configure Database User and Password For Wordpress

We should not use the root user and password for WordPress. It should be used only for administrative purposes. So let's create a new [database](https://scriptcrunch.com/tag/databases/), user, and password for the WordPress website we are going to set up.

**Step 1:** Login to MariaDB (MySQL) with root credentials you created. It will open the MariaDB shell where you can run the scripts for managing [databases](https://scriptcrunch.com/tag/databases/) and its users.

mysql -u root -p

**Step 2:** Create a database named wordpress. You can give your own database name.

CREATE DATABASE wordpress;

**Step 3:** Now create a user named wordpress\_admin for managing the wordpress database. You can choose your database username and password.

CREATE USER wordpress\_admin@localhost IDENTIFIED BY 'password';

**Step 4:** Grant all database privileges to wordpress\_admin on wordpress database.

GRANT ALL PRIVILEGES ON wordpress.\* TO wordpress\_admin@localhost IDENTIFIED BY 'password';

**Step 5:** Flush the privileges using the following command.

FLUSH PRIVILEGES;

**Step 6:** Exit the database shell

exit

### Install and Configure Wordpress

Now that we have all the components required for running WordPress, we will [go](https://scriptcrunch.com/tag/go/) ahead with the WordPress installation.

**Step 1:** Download latest WordPress

wget http://wordpress.org/latest.tar.gz

**Step 2:** Extract the tar file.

tar -xvf latest.tar.gz

**Step 3:** Copy wordpress folder content to /var/www/html folder

cp -vR wordpress/\* /var/www/html/

**Step 4:** Change the owner of /var/www/html to apache user. Because the WordPress files will be manipulated by httpd apache user.

sudo chown -R apache:apache /var/www/html/\*

#### Configuring Wordpress

**Step 1:** cd in to /var/www/html folder

/var/www/html

**Step 2:** Copy wp-config-sample.php to wp-config.php file.

cp wp-config-sample.php wp-config.php

**Step 3:** Open wp-config.php file and add the database details in the following parameters.

// \*\* MySQL settings - You can get this info from your web host \*\* // /\*\* The name of the database for WordPress \*/ define('DB\_NAME', 'wordpress'); /\*\* MySQL database username \*/ define('DB\_USER', 'wordpress\_admin'); /\*\* MySQL database password \*/ define('DB\_PASSWORD', 'password');

That's it! If you browse to the IP you will be able to access the WordPress website

Also read,

1. [How to Setup Free SSL (https) for WordPress Website using Cloudflare](https://comtechies.com/setup-free-ssl-https-wordpress.html?ref=scriptcrunch.com)
2. [How to SetUp High-Performance WordPress on Cloud/VPS](https://comtechies.com/secure-high-performance-wordpress.html?ref=scriptcrunch.com)