How to install WordPress on CentOS7

In this article, we will show you how to install WordPress on a CentOS server.

Login to your server via SSH or KVM, via root.
Disable selinux;

setenforce 0
sed -i ‘s/enforcing/disabled/g’ /etc/selinux/config

Run the following command to install all the required packages for your LAMP stack, which will host the WordPress site;

yum install httpd php php-common php-mysqlnd php-mbstring php-gd mariadb-server mod_ssl -y

Update the Apache config to allow for htaccess to be used;

sed -i ‘s/AllowOverride none/AllowOverride all/g’ /etc/httpd/conf/httpd.conf

Start Apache & MySQL on the server;

systemctl start httpd && systemctl start mariadb

You should now be able to confirm that Apache is started by going to either your server IP address or the domain name you have pointed to the server, in this example we will use the server IP address.
Create the MySQL user and database for WordPress, enter the mysql command to get to a prompt (choose a different password to the below one, just make sure it is secure!)

GRANT ALL PRIVILEGES ON wordpress.* TO ‘wordpress’@’localhost’ IDENTIFIED BY ‘Eh4wph8WItSO’;

Download and put into place the latest version of WordPress;

curl -O
tar zxvf latest.tar.gz
mkdir /var/www/html/
mv wordpress/* /var/www/html/

Update the permissions so that we can upload files through the WordPress control panel;

chown -R apache:apache /var/www/html

You can now go to your site URL or IP address in the browser to complete the WordPress installation, below are the following pages you should go through to complete the install;

On the following page you should enter the details that you used earlier when creating the MySQL database;

9. Your site is now setup and ready to login to, if you go to your URL or server IP address you should see a basic WordPress installation. You can login to your WordPress admin control panel at http://IP-ADDRESS/wp-admin/.


Bare Metal Dedicated Servers

A single tenant, physical server allowing you full access to its resources.

Browse servers

Professional Hybrid Servers

Virtualized server platform hosted on enterprise-grade physical servers.

Browse servers

Scalable Cloud Servers

High-performance and highly-available infrastructure.

Browse servers

Managed Colocation

Our next-generation data center facilities.

Browse servers

Your email address will not be published.

  1. Thanks for sharing. Some updates for CentOS 6:
    1. Why disable SELinux?
    2. CentOS 6 only support php 5.3.3 by yum, you should install the latest php version manually
    3. Before installing the mariadb-server, you should specify the repo. The mariadb-server has been updated to “MariaDB-server”
    4. systemctl seems didn’t work on CentOS 6, I used “service mysql start”, MariaDB-server and mysqld didn’t work
    5. After granting the privileges, you should exit mysql