TAX, GDP Market Wealth and Exams Series, Net worth and best SEO, and blogging articles for new bloggers. We are also publishing games reviews and technology reviews as well.

How to install Ghost using Putty on Cpanel 2018

How to install Ghost using Putty on Cpanel 2018


First of all its really tough in the beginning i found hundreds of articles explaning how to install ghost via softaculous plugin. But the problem is softaculous no longer supporting one-click ghost installation. Then i thought why not go with manual installation using Putty but it took so much time for me to succssfully get installed ghost and i believe there is lot of peoples have been trying to install it as well. The problem is i didn't found single article which explains how we can install it on cpanel. Then after trying again and again i found the final solution. So, without wasting time we are starting now.

Basic Requirements:

  • You must have full root access of your server VPS/Dedicated
  • We are going to install this on Centos 7.4 cPanel based server
  • If you have shared hosting then this post is not for you
  • You have putty installed for SSH access

So, once you done with basic requirements. We are now going to start from cPanel. Now you have to login in your WHM (Cpanel Control Panel for Admin) Once you logged then Go and create a new account of your domain, my domain e.g XYZ.COM.

Step 1.
Login in putty using your root credentials.
Ghost is built in Nodejs LTS versions and and their all supported versions we will found in . I mentioned all the New commands below.
Now we are going to install Nodesource on our server. Run following commands :
curl -sL | sudo bash -
sudo yum -y install nsolid-boron nsolid-console
It takes a while and once you done the installation of LTS Node 6.X Boron installation.
Step 2.
We are going to create mysql Username and database. We have to create it in Putty so first we will login as root in mysql run the following command:
mysql -u root -p
Then type your Mysql root password, remember this is not neccessry to have Mysql password same as root so, you can change it in WHM if you don't remember.
Now we are going to create Database "testdb" This is databse name you can change it if you want different.
create database testdb;
Now we will create a User for our database run the following command:
create user 'testuser'@'localhost' identified by 'password';
Remember "testuser" is our username for our database and password is "password" you can change it if you want different.
Now we will run the following command to grant full permission to our User:
grant all on testdb.* to 'testuser' identified by 'password';
Once done now we exit from mysql using following command:
Step 3.
Now we have to create ghost user using the following command:
sudo adduser --shell /bin/bash ghost
And in this part we will assign a installation directory:
sudo chown -R ghost:ghost /var/www/ghost/
Now we are ready for ghost installation run the following command to login as ghost user beofer this remember you have to set the password for this user using the following command:
passwd ghost
and then we will login as ghost user:
sudo su - ghost
Once you done then your next step is enter in following directory, command:
cd /var/www/
Then create a directory named ghost with following command:
mkdir ghost
Now goto this directory with following command:
cd ghost
Step 4.
Now this time we are going to install Ghost with Ghost-CLI. Ghost-CLI will comes with Nodesource LTS versions which we installed in the beginning. Ghost CLI will install all the required dependencies in your directory, now run the following command to install ghost:
ghost install
It will take 1, 2 minutes then ghost will ask your domain name, then type your domain e.g :
Now select localhost for your mysql, and then in next step it will ask for mysql Username type your username then press enter. Now we have to type our User password and then our Database name.

Once you done all of these steps it will start installing Ghost and ask you some more questions about nginx and SSL setup. If your using cPanel with nginx then you have to Skip these steps and type N. At the end of installation it will ask you to run ghost now you must have to select no and type N, .

So, till now you have done almost all steps we have one last step left. In this step you have to change ports in configuration file by default Ghost comes with Port :2368 we will change it to 2468 . Now we are going for our last step.

Step 5.
In this step we will integrate ghost with nginx. I have nginx installed in my server without integration with nginx ghost wouldn't work. Run the following commands mentioned below.
cd /etc/nginx
mkdir sites-available
mkdir sites-enabled
If you want to install SSL on your website then use following command below otherwise leave it.
mkdir ssl
OK, so now we have all the required directory's for proxying via nginx. So, now we are going to create two files and one for sites-enabled and another one for sites-available. Run the following commands:
vi /etc/nginx/sites-enabled/yourdomain
and then paste the following configuration in your file:
server { listen 80; server_name; location / { proxy_set_header HOST $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass; } }
Remember you must change to your own domain name you have to repeat this in sites-available directory as well.
You have to repeat this configuration same in sites-available:
vi /etc/nginx/sites-available/yourdomain
and then configuration file:
server { listen 80; server_name; location / { proxy_set_header HOST $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass; } }
OK, now we are done here we have to enable our domain for proxying in nginx so, for this we will add one line of code in nginx configurtion. Run the following command for editing nginx configuration:
vi /etc/nginx/nginx.conf
Add this line right below ## Virtual Host Configs ##
include /etc/nginx/sites-enabled/*;
## Virtual Host Configs ##
include /etc/nginx/conf.d/.conf;
include /etc/nginx/sites-enabled/
You can find virtual host at the end of the configuration file. Once you done here we will restart nginx , but before installation we must have to be sure we done all nginx steps accurately. So we will use this command to check nginx configuration is successfull, run the following command:
nginx -t
Result muse be:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Now its time to run our ghost after doing all the steps. Ghost always run the own user which we created in the first few steps. So, login with ghost user run the following command:
su - ghost
Then type your ghost password and then final command must:
ghost restart
and then check the status with this command and be sure everything is running fine:
ghost status
Result must be:

One last thing i forget to mention is you have to terminate your domain in cpanel. While doing this Check mark the option of Keep DNS. Please check Example image below.
Then remove this domain from your cPanel, because your all data is in the /var/www/ghost directory so we don't need cPanel account for this and add A record in your domain panel. If your using Cloudflare then go in the DNS tab and add a record name your domain and Value your IP.

Now you can check your website and your good to go.

Have a nice day!