Wordpress is the best content management system written in the PHP programming language, and it uses MySQL for the database management system. Friendly features that allow you to build your theme with unlimited plugins to let your idea come true has made the most popular CMS on the world. WordPress is easy to use, fast, and secure for your website.

In this article, we will explain How To Install WordPress with LAMP Stack on CentOS 7.


Before you begin, you will need:

Step 1 - Download WordPress

After you have successfully installed LAMP Stack based on the article above, change current directory to web directory:


cd /var/www/html

Now download the latest WordPress file by running this command:



Next, extract the WordPress file in the current directory:


tar xvzf latest.tar.gz

After, you need to move files from wordpress directory into web directory:


mv /var/www/html/wordpress/* /var/www/html

Step 2 - Create a MySQL database

You will need a database to store, collect, and retrieve website information. Now we need to create a MySQL database. First login to MySQL:


mysql -u root -p

Enter the password, and create a database name:



After, grant privileges on the database name, create a database user, and set password:


GRANT ALL PRIVILEGES on wordpress.* to 'wordpress_user'@'localhost' identified by 'wordpress_pw';

Flush privileges to make changes.



And log out from MySQL:



You have successfully created a database for your WordPress site. Now, change the WordPress configuration file with the database that you created. First, rename wp-config-sample.php to wp-config.php:


mv wp-config-sample.php wp-config.php

Open wp-config.php file:


nano wp-config.php

Change lines in red: Wordpress configuration file With the database that you created above: wordpress configuration file Close file by pressing CTRL+X, type Y to save changes and hit Enter.

Step 3 - Install PHP 7

If you have followed the article in Prerequisites section, you will need to update your PHP to 7.0 or later. To update you will need to install Remi and Epel repositories:


yum install epel-release yum-utils -y yum install

Now enable PHP 7.0 repo:


yum-config-manager --enable remi-php70

And install PHP 7.0 with msyql module:


yum install php php-mysql

Restart the webserver to take changes:


systemctl restart httpd

Step 4 - WordPress installation

Once you have successfully followed this article, open browser and go to or http://youripaddress. After you have gone to your site, you will get the famous five-minute installation process: Wordpress Installation page Provide the information below by your preferences and click on the Install WordPress button to finish the installation process: wordpress installation page Now, log in to your WP Admin Panel: wordpress step 2wordpress login page And manage your WordPress site: wordpress admin dashboard


You have successfully installed WordPress with LAMP Stack on CentOS 7. Now you have created your website, and you can design it for your wishes.

Read more about: CentOSOperating System