How to install WordPress on your VPS step by step with command, fastest and most popular methods to deploy your WordPress app
How to install WordPress on your VPS step by step with command, fastest and most popular methods to deploy your WordPress app
About 30.3% of the top 1000 websites online are powered by WordPress. These stats say a lot about the popularity and interest for WordPress. Also, WordPress websites rank high on Google.
You will be surprised to know that WordPress takes care of 80-90% of Google traffic problems. If you choose to install WordPress on your VPS hosting server, it can be difficult but not impossible.
In this blog, we will discuss how to install WordPress on your VPS server. You can accomplish this using cPanel, auto-install, or using CWP. Let's get right into it.
HOW TO INSTALL WORDPRESS ON VPS MANUALLY USING CPANEL.
STEP 1 – DOWNLOAD WORDPRESS.
It’s quite a simple and straightforward process. Begin by downloading the latest version of WordPress on their official website.
Also Read: VPS Hosting VS. Dedicated Hosting – 6 Key Factors To Consider.
STEP 2 – UPLOAD WORDPRESS TO VPS.
You need to upload the zip file, which has the contents required to install WordPress. Access your cPanel account to start the installation process. Bear in mind that you need to set up your cPanel if you have recently purchased the plan.
Alternatively, you can even upload these files using programs like CyberDuck, WinSCP, Bitkinex, etc.
In my opinion, the cPanel file manager tool is the best, but you can use whatever suits you best. cPanel is excellent for people who are not familiar with FTP applications or can’t access them.
Log in to your cPanel account and click on the file manager option.
Now, proceed to the public_html directory and click on the same.
If you are doing this for the first time, you will have to create a website folder. Ignore this step if you have already created a folder.
Now, click on the +Folder option.
Name the folder and open it. Click on the upload option.
Now, click on the option called – Select file & upload the zip file you downloaded initially.
After the zip file is fully uploaded, click on the link at the bottom, which says – Go back to “home/newhostitsmart” (just an illustration). It will redirect you to the file directory.
When you reach the previous page, click reload, and it will show you the zip file you uploaded. Choose the zip file and click on the Extract option.
Now, a popup will appear on your screen asking you to confirm the extract location. Be very careful when you choose the extract location. Once you have selected the proper location, click on the extract file option.
Your file directory will now have WordPress. At this point, it is safe to delete the zip file from the directory.
Also Read: 22 Best Plugins For WordPress In 2022
STEP 3 – MOVE WORDPRESS FILES TO THE ROOT DIRECTORY.
Congratulations, you have all the WordPress files in possession, but the mission is far from over. You need to move them to the correct location.
Access the WordPress folder and select all the files inside.
Using the move option, move all the files into the public_html directory.
Click on the move files option only after you have selected the correct location.
STEP 4 – CREATE A FRESH DATABASE.
Have patience, my friend. We are almost at the end; it is time to create a fresh database. Go to cPanel and click on the MySQL Database Wizard option. It is mandatory to name the database.
Choose a name like WP2021 or something like that because you need to remember it to complete the steps that come later.
Once you name the database, click on the button – Next step.
Now, create a username and password for the database.
After you complete these steps, click on the create user button. The next step is to choose the privileges you want for the account. To do this, click on the option – All privileges followed by the button – Next step.
Awesome, you have successfully created the database.
Important note – Jot down the database name, username, and password because you will need them to connect WordPress to the database.
Also Read: WordPress.Com Vs WordPress.Org – What’s The Difference?
STEP 5 – EDIT THE WP-CONFIG-SAMPLE.PHP FILE.
All the hard work you have put in to create a database is of no use if WordPress cannot use it. To make it possible for WordPress to use the database, you need to edit the wp-config-sample.php file.
How do you edit the wp-config-sample.php file? Access the public_html directory and select the wp-config-sample.php file. Now, right-click on the file and choose the edit option.
Suddenly, you will see a popup on your screen that provides options like download, view, edit, move and copy. To continue, click on the edit button.
Inside the same file, you need to find and replace three specific lines to ensure that it connects with the database you created.
First, locate –
define( ‘DB_NAME’, ‘database_name_here’ );
Then, replace database_name_here with the name of your database.
define( ‘DB_USER’, ‘username_here’ );
Now, replace username_here with the username you created.
Finally, locate –
define( ‘DB_PASSWORD’, ‘password_here’ );
Replace password_here with the password you created.
After locating and replacing everything, it brings us to the last hurdle. Copy and paste a fresh set of Salt keys from the WordPress API. Access the Salt Key Generator and copy all the contents.
Next, replace the salt key lines in the wp-config-sample.php file with the contents you copied from the Salt Key Generator and save the changes.
At last, you have to close the file. Post configuration, it is not a sample anymore. Hence, you need to rename it to wp-config.php.
STEP 6 – INSTALL WORDPRESS
You can pat yourself on the back. After putting in all the hard work, all you need to do is visit your website and install WordPress.
Visit yourwebsite.com/wp-admin/install.php to do the needful.
Now, you know how to install WordPress on the VPS server manually.
Also Read: Using WordPress For Your Next Website Project? Understanding Its Pros And Cons!
HOW TO INSTALL WORDPRESS ON VPS THROUGH CPANEL (AUTOMATIC PROCESS)
Before opting for the automatic process, we need to keep in mind that we require the three things below.
- A domain name. For example – www.mydomainmychoice.com
- A web hosting account that supports cPanel, PHP, and MySQL
- cPanel username and password.
Also Read: EVERYTHING YOU NEED TO KNOW ABOUT CPANEL – BEGINNER’S GUIDE
STEP 1 – LOG ON TO YOUR CPANEL ACCOUNT.
If your domain name is www.mydomainmychoice.com, that’s associated with your hosting account, then log in to your browser and type www.mydomainmychoice.com/cPanel
Now, pull out the details of your username and password that you received when you signed up with your hosting provider. Enter those details as shown below.
STEP 2 – LOCATE SOFTACULOUS APPS INSTALLER.
Once you log in, you will see the cPanel dashboard. Find a text box that says – Find the functions by typing here. Type Softaculous in the box, and under Softaculous apps installer, you will find a host of scripts that it supports. WordPress would be one of them. Click on it and proceed.
STEP 3 – CHOOSE A PROTOCOL AND A DOMAIN NAME.
After you click on the WordPress icon, it will lead you to a new screen. The new screen will display details of the WordPress version you are about to install on your website.
Proceed to click on the install button. A new page will appear in front of you, which will guide you through the software installation.
Select your desired protocol. You can choose http://www. Or https://www, but understand that you can only use https://www if you have an SSL certificate for your domain.
Then you can choose your domain. You will come across a textbox labeled – In Directory. Leave it blank unless you want to install WordPress under a separate sub-folder.
STEP 4 – FILL OUT DETAILS OF YOUR WORDPRESS WEBSITE.
Below is an example of the website settings.
Now, enter your website’s name and also include a brief description. Choose an admin user name, password, and email address. You will require these credentials to into your WordPress admin account, so note down these details carefully.
Think of a strong password to ensure the safety of your WordPress account. Now, select the language of your choice and proceed further.
STEP 5 – CHOOSE PLUGINS AND A THEME.
If you want to install some plugins, an option will appear in front of your screen. It is not mandatory to do so, but you can choose your desired theme if you would like to.
Don’t forget to enter your email address when prompted. A textbox saying – “Email installation details to” will appear in front of you; remember to enter your email details there. Now, click on the install button.
The Softaculous installer will verify all the details that you submitted and install WordPress on your website.
Upon successful verification and installation, you will receive a confirmation on your registered email address. The message will be something like Congratulations; we have successfully installed WordPress on your website.
WordPress has been successfully installed on – www.mydomainmychoice.com
Administrative URL – www.mydomainmychoice.com/wp-admin/
NOTE – Softaculous is simply an automatic software installer, and you won’t receive any support for individual software packages. For further assistance, you need to contact the respective software provider’s website.
STEP 6 – ASSESS THE PERFORMANCE OF THE INSTALLATION.
Type your administrative URL – www.mydomainmychoice.com/wp-admin/ and log into your WordPress website.
Congratulations, your installation process is now complete. Your WordPress dashboard will display numerous customization options, including theme changes, shortcut to creating blog posts, adding pages, enabling comments, and much more.
You can install WordPress on your website using cPanel quite easily. As seen above, there is no need to download the source code or painstakingly create a database step by step. Softaculous will do it all for you.
The dashboard will give you an impressive overview of your website; you can personalize it to your liking and start uploading content.
HOW TO INSTALL WORDPRESS ON VPS THROUGH CWP (AUTOMATIC)
Owing to WordPress’s immense popularity, you might want to install it on your VPS server, especially when using CWP. Let’s discuss how to install WordPress on your CentOS Web Panel.
- CWP installed & configured.
- CWP user-created
- Desired domain DNS records set up in Cloud DNS Manager or CWP.
- You can also configure CWP.
STEPS TO INSTALL WORDPRESS THROUGH CWP. (AUTOMATIC)
Log on to the CWP’s user admin panel.
Proceed to the Add ons section, you will see the WordPress icon. Click on the same to begin the installation process.
Meanwhile, we will also select the protocol, domain, and root directory for the WordPress installation. Focus on the content in the directory box because a tiny mistake can cause serious repercussions.
Now, click install.
Go to List Accounts and navigate to the WordPress website.
Then, open USER DIR.
You will see a screen that provides options to select the language for your website.
The next step is to fill out the website information and administrator login information.
Now, click on the install button, and if everything goes smoothly, you will get this message –
Success! WordPress has been installed. Thank you and enjoy.
Now that you have successfully installed WordPress, all you need to do is log in and manage your website.
HOW TO INSTALL WORDPRESS ON CWP. (MANUAL)
Let’s go through the steps to install WordPress on CWP. (a manual process)
1. Open the CWP panel and create a new account.
2. Create a MySQL database. First of all, find SQL services, choose MySQL manager and then click on – Create database and user.
3. Obtain SSH access to servers and run the below-mentioned commands.
- CD /home/USERNAME/public_html
- wget http://wordpress.org/latest.tar.gz
- tar xvzf latest. Tar. gz
- mv WordPress/*.
- rm -rf WordPress
- chown -R USERNAME: USERNAME *
More details with pictures
Download the latest version of WordPress
First of all, we need to start by getting the latest version of WordPress, so we're going to download it.
You can go to the "/tmp" folder to locate the download.
Then with curl, we will access the WordPress site:
curl -LO https://wordpress.org/latest.tar.gz
The download continues and we then have a "latest.tar.gz archive".
Unzip the archive
We will therefore extract the contents of this archive in the current directory:
tar xpf latest.tar.gz
We can finally if we want to delete the archive whose content has been extracted to a new "wordpress" directory.
Moving the folder to our Apache root directory
We now want to put WordPress online and be able to access it by entering the ip address of our server (or the domain name if we have already done so).
For now, our Apache HTTP server, as installed and configured on our VPS in previous articles, directs us to the contents of the root directory:
Which basically contains an html page generated when the server is installed. We don't really need this content anymore, so we'll delete it (be careful if you've already created different content in this directory not to delete it!):
We can then move all the contents of our "wordpress" folder to the Apache root directory:
cp -r wordpress/* /var/www/html/
The WordPress folder is now available by accessing our HTTP server but before continuing to the configuration we must perform two additional steps: modify the user rights on the directory and create a database in MYSQL to accommodate the WordPress data.
Directory Rights Management
You will modify the access rights to the directory and recursively to its children by entering the command:
chown -R www-data:www-data /var/www/html/ chmod -R 755 /var/www/html/
Creating a database in MYSQL
In order to be able to store WordPress data, we need to create a database in which tables will be automatically generated when installing and using our WordPress site. You must connect to MYSQL using the root user:
mysql -u root -p
Then we will run the following SQL queries to create a database and assign the rights to the desired user (we will avoid using root to directly access our MYSQL via WordPress)
CREATE DATABASE wp_database; GRANT ALL ON `wp_database`.* TO `utilisateur`@`localhost`; FLUSH PRIVILEGES;
We are ready to set up WordPress, everything is happening now in our web browser!
Hello WordPress: upload and starting configuration
First access to WordPress
In our Web Browser, we will enter the IP address of our server and we will be automatically redirected to "http:// ip/wp-admin/setup-config.php" where we can start configuring our WordPress site, the following page will be displayed:
We will choose the desired language for our WordPress administration interface and we will move on to the next page by validating our choice.
The next page simply informs us of what we will need to continue installing WordPress: a database, which we have already created previously. So we can go to the next page "Let's go!".
We are asked to fill in the information about our database:
We will then enter the name we previously assigned to our MYSQL database: wp_database. Then the necessary credentials to connect to MYSQL. The database is installed on our server and accessible locally, so we will leave the host as localhost and we will not change the prefix of the WordPress tables, leaving wp_. We can validate the information and the following page will be displayed:
Everything is ready to start the installation by clicking on the available button!
To finally arrive at the last step of configuring the WordPress site: the creation of our administrator account that will allow us to manage our site:
All we have to do is choose a title for our site, and provide a username as well as a password and our email address. To prevent our site from being indexed by search engines such as Google, we can check the option available on "Search Engine Visibility". And then we can validate.
Our WordPress site is finally installed! Hello World! Let's get to it by entering the IP address of our server in our browser: