75% OFF ALL NEW PLANS + 100-DAY MONEY-BACK GUARANTEE
75% OFF ALL NEW PLANS

 ghost_logo.png

This tutorial will show you how to install the CMS and blogging platform Ghost.

If you do not have a WebApps section in your hosting Control Panel, then this tutorial is not suitable for your particular hosting environment. You can contact us via our ticketing system for further assistance.

1. Create an app using the WebApps section of the hosting Control Panel

  • Choose Node.js LTS as engine. This is way, the app will use the latest Node.js LTS version which will almost always be Ghost's current recommended Node.js version.
  • Enter a name for your app. It is only for internal reference to the app. In this example, it is ghost.
  • Choose a subdomain at which you wish to access Ghost. In this example, we choose the default "www" subdomain.
  • Enter the web access path. For example, if you enter /ghost, you will be able to access the app at https://www.example.com/ghost. You do not need to create the directory. In this example, we enter / (forward slash) as web access path, so the app is accessible at https://www.example.com.
  • The port will be assigned automatically. It will be transparent to your users. You can see the port in the apps list after creating the project.
  • Leave the deployment directory as /private. You will change it later when configuring the app.

    ghost_app.png

2. Create a MySQL database for Ghost

  • Create a new MySQL database via the MySQL Databases section in your hosting Control Panel. It is recommended that you create a separate database user, too. More information can be found in our MySQL Databases article. In our example, we use myusername_ghost as database name, ghostuser as database username, and ghostpassword as password.

3. Enable an SSL certificate and force HTTPS connections.

You can easily enable a free Let's Encrypt certificate by using the SSL/HTTPS -> Let's Encrypt certificates section of the hosting Control Panel as described in the Let's Еncrypt certificates section from our online documentation. After that, you can use the SSL/HTTPS > Force HTTPS section to force HTTPS connections to the domain/subdomain where Ghost will be running. 

4. Install Ghost.

First you need to connect to your account via SSH. You can check our online documentation for more information on doing this:

Logging Into Your Account via SSH using Putty
Logging Into Your Account via SSH using Terminal in Mac OS

Once you have connected via SSH, you can enter the shell of your web app with the following command (replace ghost with the name of your web app):

sureapp project shell ghost

Next, run the following command to install the Ghost command line utility:

npminstall [email protected] -g 

To install Ghost with a MySQL 5 database, run the following command: 

ghost install --url https://$SUBDOMAIN.$DOMAIN$URL_PATH --port $PORT --db mysql --dbhost localhost --dbname myusername_ghost --dbuser ghostuser --dbpass ghostpassword --dir /home/$USER/private/ghost --process local --no-setup-linux-user --stack false --no-start

If you wish to use a MySQL 8 database, you will need to also specify the database connection port as 3308:

ghost install --url https://$SUBDOMAIN.$DOMAIN$URL_PATH --port $PORT --db mysql --dbhost localhost --dbport 3308 --dbname myusername_ghost --dbuser ghostuser --dbpass ghostpassword --dir /home/$USER/private/ghost --process local --no-setup-linux-user --stack false --no-start

You should replace the parts in bold with the respective values for your web app.

dbname: the name of the MySQL database you created at step 2
dbuser: the MySQL user you created at step 2
dbpass: the password for the MySQL user
dir: the directory where Ghost should be installed. It must be an empty subdirectory of the private directory on your account. If the directory does not exist, the installer will create it for you.

The installer should finish with the following output:

Ghost was installed successfully! To complete setup of your publication, visit:
https://www.example.com/ghost/

The setup URL of Ghost is not working as we have not yet started and configured the web app.

5. Configure and start the Web App.

Make the following changes to the Web App:

  • Change the deployment directory to the location where Ghost was installed. In this example it is /private/ghost.
  • Enter the following in the 'Start command' field:

node current/index.js

  • Add the following environment variable:

NODE_ENV production

This way Ghost will run in production mode.

ghost5.png 

Save the changes and click on the red 'Enable the app' button. Ghost should start after a few seconds and you can complete the setup by visiting the URL that was provided by the installer (https://www.example.com/ghost/ in our example). To invite staff, you first need to configure the email service following the instructions provided in the next step.

 6. Configuring the email service

For Ghost to be able to send email, you can configure it to use the Sendmail binary on the server. To do this, you have to edit the Ghost configuration file config.production.json which is located in the Ghost installation directory. You can easily edit the file through the File Manager interface of the hosting Control Panel. Change the following lines in config.production.json:

 

  "mail": {
    "transport": "Direct"
  },

to

  "mail": {
    "transport": "sendmail",
            "options": {
                "path": "/usr/lib/sendmail"                
            }
        },


For the change to take effect, restart the Web App by clicking the green 'Disable the app' button, and then the red 'Enable the app' button.