YouTube Icon

Code Playground.

How to Install WordPress with Apache on CentOS 7


How to Install WordPress with Apache on CentOS 7

WordPress is the most well known open-source writing for a blog and CMS stage around the world, fueling a fourth of all sites on the Internet today. It depends on PHP and MySQL and packs a huge load of highlights that can be stretched out with free and premium modules and topics. WordPress is the least difficult approach to make your online store, site, or blog. 

In this instructional exercise, we will disclose how to introduce WordPress on CentOS 7. At the hour of composing this article, the most recent variant of WordPress is adaptation 5.0.3. 

We'll be utilizing a LAMP stack with Apache as a web worker, SSL testament, the most recent PHP 7.2 and MySQL/MariaDB as an information base worker. 


Guarantee the accompanying essentials are met prior to proceeding with this instructional exercise: 

A space name highlighted your worker public IP address. We will utilize 

Signed in as a client with sudo advantages . 

Apache introduced by adhering to these guidelines . 

PHP 7.2 introduced by adhering to these guidelines . 

You have a SSL endorsement introduced for your area. You can create a free Let's Encrypt SSL authentication by adhering to these guidelines . 

Creating MySQL Database

WordPress stores its information and arrangement in a MySQL information base. On the off chance that you as of now don't have MySQL or MariaDB introduced on your CentOS worker you can introduce by following one of the aides beneath: 

Introduce MySQL on CentOS 7 . 

Introduce MariaDB on CentOS 7 . 

Login to the MySQL shell by executing the accompanying order: 

mysql -u root -p

From inside the MySQL shell, run the accompanying SQL explanation to make another information base named wordpress: 

CREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

Next, make a MySQL client account named wordpressuser and award the important authorizations to the client by running the accompanying order: 

GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'change-with-strong-password';

When done, leave the mysql support by composing: 


Downloading Wordpress

The accompanying order will download the most recent variant of WordPress from the WordPress download page with wget and remove the file to the area's record root registry: 

wget -q -O - "" | sudo tar -xzf - -C /var/www/html --transform s/wordpress/

Set the right authorizations with the goal that the web worker can have full admittance to the website's records and registries: 

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

Configuring Apache

At this point, you should as of now have Apache with SSL authentication introduced on your framework, if not check the requirements for this instructional exercise. 

Open your word processor and alter the area's Apache virtual hosts arrangement : 

sudo nano /etc/httpd/conf.d/

Remember to supplant with your Wordpress space and set the right way to the SSL declaration records. 


<VirtualHost *:80>

  Redirect permanent /

<VirtualHost *:443>

  <If "%{HTTP_HOST} == ''">
    Redirect permanent /

  DirectoryIndex index.html index.php
  DocumentRoot /var/www/html/

  ErrorLog /var/log/httpd/
  CustomLog /var/log/httpd/ combined

  SSLEngine On
  SSLCertificateFile /etc/letsencrypt/live/
  SSLCertificateKeyFile /etc/letsencrypt/live/
  SSLCertificateChainFile /etc/letsencrypt/live/

  <Directory /var/www/html/>
      Options FollowSymLinks
      AllowOverride All
      Require all granted


The arrangement will advise Apache to diverts HTTP to HTTPS and www to non-www variant of your area. 

Restart the Apache administration for the progressions to produce results: 

sudo systemctl restart httpd

Completing the WordPress Installation

Since Wordpress is downloaded and the Apache worker is designed, you can complete the establishment through the web interface. 

Open your program, type your area and a screen like the accompanying will show up: 

Select the language you might want to utilize and tap on the Continue button. 

Next, you will see the accompanying data page, click on the Let's go! button. 

On the following screen, the arrangement wizard will request that you enter your information base association subtleties. Enter the MySQL client and information base subtleties you recently made. 

Start the WordPress establishment by tapping on the Run the Installation button. 

In the subsequent stage, you'll have to enter a name for your WordPress site and pick a username (for security purposes don't utilize "administrator" ). 

The installer will naturally produce a solid secret phrase for you. Remember to spare this secret key. You can likewise set the secret phrase without help from anyone else. 

Enter your email address and select whether you need to debilitate web crawlers from ordering the webpage (not suggested). 

Snap Install WordPress and once the establishment is finished you will be taken to a page advising you that WordPress has been introduced. 

To get to your WordPress login page click on the Log in catch. 

Enter your username and secret word. 

You will be diverted to the WordPress organization dashboard. 

From here, you can begin altering your WordPress establishment by putting in new topics and modules. 


Congrats, you have effectively introduced WordPress with Apache on your CentOS 7 worker. Initial Steps With WordPress is a decent beginning spot to study how to begin with WordPress. 

On the off chance that you have questions, don't hesitate to leave a remark beneath.