Node.js App setup guide

If you are currently on a CloudLinux 7 server, you will need to be moved to a CloudLinux 8 server before you can install Ghost. Please contact support for more information.
  1. From the cPanel SOFTWARE section, click the Setup Node.js App icon.
  1. 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 12.

  1. 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/12/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.
    pwd
    You'll see something like:
    /home/krystald/myghostblog 
  2. 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:
    npm WARN lifecycle The node binary used for scripts is /home/krystald/nodevenv/myghostblog/12/bin/node but npm is using /opt/alt/alt-nodejs12/root/usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

    > yarn@1.22.10 preinstall /home/krystald/nodevenv/myghostblog/12/lib/lib/node_modules/ghost-cli/node_modules/yarn
    > :; (node ./preinstall.js > /dev/null 2>&1 || true)

    /home/krystald/nodevenv/myghostblog/12/lib/bin/ghost -> /home/krystald/nodevenv/myghostblog/12/lib/lib/node_modules/ghost-cli/bin/ghost
    + ghost-cli@1.17.3
    added 419 packages from 207 contributors in 73.013s
    The ghost cli is now installed (the warning is due to the presence of Cloudlinux nodejs selector and can be safely ignored). We will need your version of the path highlighted in bold from this response in a while, so make a note of it.
  3. 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
    pwd
    You should see your application root path:
    /home/krystald/myghostblog
    Once the path is confirmed type the following to remove all the files:
    rm -rf *
  4. 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 - found v12.22.1
    ✔ Checking current folder permissions
    ✔ Checking memory availability
    ✔ Checking free space
    ✔ Checking for latest Ghost version
    ✔ Setting up install directory
    ✔ Downloading and installing Ghost v4.6.4
    ✔ Finishing install process
  5. This process can take two or three minutes 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:
    mkdir public
    chmod 755 public
  6. Type the following to view your Application root file structure:
    ls -la
    It should look something like this:
    drwxr-xr-x  5 krystald krystald  108 Jun  1 09:27 .
    drwx--x--x 34 krystald krystald 4096 Jun 1 08:06 ..
    -rw-rw-r-- 1 krystald krystald 82 Jun 1 09:24 .ghost-cli
    drwxrwxr-x 8 krystald krystald 114 Jun 1 09:21 content
    lrwxrwxrwx 1 krystald krystald 41 Jun 1 09:24 current -> /home/krystald/myghostblog/versions/4.6.4
    drwxr-xr-x 2 krystald krystald 6 Jun 1 09:27 public
    drwxrwxr-x 3 krystald krystald 27 Jun 1 09:21 versions
  7. 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  1 09:28 .
    drwx--x--x 34 krystald krystald 4096 Jun 1 08:06 ..
    -rw-rw-r-- 1 krystald krystald 82 Jun 1 09:24 .ghost-cli
    -rw-rw-r-- 1 krystald krystald 393 Jun 1 09:28 config.production.json
    drwxrwxr-x 8 krystald krystald 114 Jun 1 09:21 content
    lrwxrwxrwx 1 krystald krystald 41 Jun 1 09:24 current -> /home/krystald/myghostblog/versions/4.6.4
    drwxr-xr-x 2 krystald krystald 6 Jun 1 09:27 public
    drwxrwxr-x 3 krystald krystald 27 Jun 1 09:21 versions
  8. 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.
  9. 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.
  10. To set up our blog, browse to http://krystaldemo.co.uk/blog/ghost (your URL will differ, depending on the URL you set up for the Application) - here you can set up your own admin login:
  11. 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


How did we do?


Powered by HelpDocs (opens in a new tab)
© Krystal Hosting Ltd 2002–