Installing WordPress On CentOS 7 With These Easy Steps!

Install WordPress on CentOS 7

Staying on web hosting for a long time can be hectic if you’re posting great content. And since we know, great content attracts a great number of visitors too. But when you’ve got many readers to read your blog, you’ll need more power to handle greater traffic. The best thing to upgrade to is, a VPS. A VPS is a virtual private server on which you have full root access and dedicated resources solely for you to use. This option will be more efficient for you. So today, we will be installing WordPress on CentOS 7!

What is VPS?

“A virtual private server is a virtual machine sold as a service by an Internet hosting service. The virtual dedicated server has also a similar meaning.” – Wikipedia.

Virtual Dedicated server is quite similar except a whole physical core is assigned to your machine for better performance(which is needed while running CPU-critical environment based scripts/applications). To connect to VPS, follow our article on “How To Connect To VPS using Putty“.

Installing WordPress on CentOS 7

Enough of the introductions. Now let’s install WordPress.

Step 1 – Updating Packages

Before we begin, we’ll make sure that every package that is needed to run a Linux CentOS environment is updated. To update, use the below-mentioned command.

sudo yum -y update

We’re done installing updates for the pre-existing packages. We’ll now begin for step two.

Step 2 – Installing Required Packages / Installing LAMP Stack

Use the following command to install required packages that we’ll need in the future to continue the smooth installation process.

yum install unzip wget nano

We’ve learned how to install LAMP Stack on your Linux machine in another article. Please follow all the steps from Step 1 to Step 5 properly from the given article and continue with this article. if you have already installed LAMP Stack on your VPS, move on to the next step.

Step 3 – Create a MySQL Database

We need to set up a separate MySQL database for WordPress. Use the below-mentioned command to create a MySQL database. Note – Copy commands one-by-one.

mysql -u root -p

mysql> CREATE DATABASE wordpress;
mysql> GRANT ALL PRIVILEGES on wordpress.* to 'wpuser'@'localhost' identified by 'your_password';
mysql> FLUSH PRIVILEGES;
mysql> exit

Make sure you change the above values likes ‘your_password'(without quote), with your own password for WordPress database. Make sure it is strong and has never been in any breach. To check, go to HaveIBeenPwned’s Password section and enter your password which you’re going to use and it will let you know if it was previously hacked by anyone in any breach which were leaked online.
Now restart MySQL with this command –

systemctl restart mariadb

Our MySQL database should now be working fine and ready to be connected to WordPress.

Step 4 – Installing & Configuring WordPress

We now will download and unzip WordPress with the commands.

wget http://wordpress.org/latest.zip
unzip -q latest.zip -d /var/www/html/

Now let’s assign proper permission to Apache Web Server to control WordPress file for correct functionality.

chown -R apache:apache /var/www/html/wordpress
chmod -R 755 /var/www/html/wordpress

Please note that we need to manually create uploads directory of WordPress. To do so, use the following command.

mkdir -p /var/www/html/wordpress/wp-content/uploads

Ops! We forgot setting up permission for “uploads”. Let’s do it.

chown -R :apache /var/www/html/wordpress/wp-content/uploads

Now enter the directory of WordPress, to begin with, further setup.

cd /var/www/html/wordpress/

With ls, you can see the list of files in your current directory.

ls

As you might have noticed, WordPress’s configuration file is named as “wp-config-sample.php”. We need to rename it as “wp-config.php” to make it function. To do so, use the below-mentioned command.

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

Now let’s edit ‘wp-config.php’ file. To do so, we’ll use nano.

nano wp-config.php

As we know, we created the MySQL database in Step 3. We will use the same credentials to configure WordPress.

// ** 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', 'wpuser');

/** MySQL database password */
define('DB_PASSWORD', 'your_password');

/** MySQL hostname */
define('DB_HOST', 'localhost');

To save the file, press CTRL + X and then press “y” and it will ask you if you really want to save. Press ‘Enter’. In short, ‘CTRL + X > press y > press Enter’ and saved! Make sure you scroll down with arrow key and find these line and edit it accordingly and don’t touch other lines unless you completely know what you’re doing or it may result in errors.

Everything should now be working and we have configured WordPress. Now let’s install it.

Installing WordPress

To install WordPress after configuring it, go to http://your_ip_address/wordpress/wp-admin/install.php (replace your_ip_address with your server’s IP) and continue with the steps that WordPress instructs and you shall be able to completely work the way out of installing WordPress.

Installing WordPress on CentOS 7


Conclusion

Please share your thoughts and feedback in the comment section below. It will help us to improve our article significantly and we may credit you if we think that your suggestion is acceptable. So with this, we’re done installing WordPress on CentOS 7 machine. If you have any suggestion for more article like this, please comment!

Are you looking for a DDoS protected VPS to run your WordPress blog? Shadow Hosting has got you covered! With our pre-included Anti-DDoS mechanism included, our VPS comes handy to any of the developers looking out to try new stuff at one of the most affordable prices. Check out our VPS Hosting page for more information. Our support team shall help you in any error you encounter while installing WordPress on your VPS.

Does it seem too difficult to install everything? Why not have a WordPress hosting instead? Yes, WordPress hosting exists! Get WordPress Hosting starting from just $2 per month and get our smart technician to install WordPress on it for you! Our WordPress hosting comes with managed support for standard WordPress jobs to be done as long as you’re hosted under us.

About Manal Shaikh 17 Articles
Manal Shaikh, the Founder of Shadow Networks International and CEO/Chairman of Shadow Hosting International. A cybersecurity analyst, network analyst and a web administrator.

2 Comments

  1. Hello Manal, Firstly, thanks for your sharing article. I´m a beginner WordPress developer. I have read this article. There is very important think of installing WordPress on centos 7. Here has clearly explained of VPS. The think very importantly. Today, I have a new experience in this blog. Now, I´ll share this post on social media:) Thank You!!!

Leave a Reply

Your email address will not be published.


*


CommentLuv badge