From the cPanel SOFTWARE section, click the Setup Node.js App icon.
Click the CREATE APPLICATION button. Complete the fields.In this example, we will be installing the application in /home/youraccount/myghostblog, and be serving it from http://krystaldemo.co.uk/blog, using Node.js version 10.
Installation of the Ghost blog software must be done from the command line. SSH into your account, and enter this command (replacing your cPanel username and Application root as required).
source /home/krystald/nodevenv/myghostblog/10/bin/activate && cd /home/krystald/myghostblog
This will enter you into a virtual shell environment setup for the Node.js version your application uses. Entering the 'pwd' command should show that you are now in the application's root directory.
You'll see something like:
Next, install the ghost-cli, a command-line interface for managing ghost installations by typing the following:
npm install ghost-cli@latest -g
You'll see a response something like this:
/home/krystald/nodevenv/myghostblog/10/lib/bin/ghost -> /home/krystald/nodevenv/myghostblog/10/lib/lib/node_modules/ghost-cli/bin/ghost + firstname.lastname@example.org added 363 packages from 191 contributors in 27.297s
The ghost binary (which is actually the ghost-cli binary) is installed. We will need your version of the path highlighted in bold from this response in a while, so make a note of it.
Now, we must remove all files from the application root directory (/home/krystald/myghostblog) so it's empty again (otherwise ghost won't install in the next step). BE VERY CAREFUL to make sure you are in the correct directory - enter the pwd command again to make sure you are in the Application root directory before issuing the rm -rf * command
You should see your application root path:
Once the path is confirmed type the following to remove all the files:
rm -rf *
Now we are ready to install the ghost blog software itself. We don't want it to try and install nginx or MySQL, so we use the --no-setup option along with the ghost cli command we highlighted above.
ghost install local --no-setup
You'll see a response something like this:
✔ Checking system Node.js version ✔ Checking current folder permissions ✔ Checking memory availability ✔ Checking for latest Ghost version ✔ Setting up install directory ✔ Downloading and installing Ghost v2.31.1 ✔ Finishing install process
This process can take a minute or two, so please be patient. Once installed, there are a few things we need to do in order to get Ghost running. Passenger, the software which allows your application to be served via LiteSpeed, requires the public directory exist in the Application root, so run the following commands:
chmod 755 public
Type the following to view your Application root file structure:
It should look something like this:
drwxr-xr-x 5 krystald krystald 103 Oct 3 08:57 . drwx--x--x 24 krystald krystald 4096 Oct 3 08:53 .. drwxrwxr-x 8 krystald krystald 108 Oct 3 08:51 content lrwxrwxrwx 1 krystald krystald 42 Oct 3 08:53 current -> /home/krystald/myghostblog/versions/2.31.1 -rw-rw-r-- 1 krystald krystald 60 Oct 3 08:53 .ghost-cli drwxr-xr-x 2 krystald krystald 10 Oct 3 08:57 public drwxrwxr-x 3 krystald krystald 27 Oct 3 08:51 versions
Now we must configure the application's basic settings by entering this command:
ghost config --url http://krystaldemo.co.uk/blog --db sqlite3 --dbpath content/data/ghost_dev.db --mail Direct
If all goes well, this command will not print anything to the screen, and you will be returned to the command prompt.
If you enter ls -la you should now see the file structure includes a new file config.production.json :
drwxr-xr-x 5 krystald krystald 142 Jun 26 10:02 . drwx--x--x 24 krystald krystald 4096 Jun 26 10:01 .. -rw-rw-r-- 1 krystald krystald 386 Jun 26 10:02 config.production.json drwxrwxr-x 8 krystald krystald 114 Jun 26 09:59 content lrwxrwxrwx 1 krystald krystald 42 Jun 26 10:01 current -> /home/krystald/myghostblog/versions/3.21.0 -rw-rw-r-- 1 krystald krystald 60 Jun 26 10:01 .ghost-cli drwxrwxr-x 2 krystald krystald 6 Jun 26 10:01 public drwxrwxr-x 3 krystald krystald 28 Jun 26 09:59 versions
We now need to tell cPanel/Passenger where to find the startup file for the Ghost application. Go back to the cPanel Node.js setup screen and click the STOP button at the top and wait for the application to stop running. Then, edit the Application startup file path as shown.And then click the SAVE button, and then the START APP button.
It may take a few moments for the application to start, during which time you may see the following message.This is normal. After a few moments, you should be able to refresh the page and see your blog.
To set up our blog, browse to http://krystaldemo.co.uk/blog (your URL will differ, depending on the URL you set up for the Application) - here you can set up your own admin login:Once you have set up your admin area, to get back to the admin login in future, simply append ghost to the end of your blog URL e.g. http://krystaldemo.co.uk/blog/ghost