1. Home
  2. Guides
  3. Installing Ghost

Installing Ghost

Overview

Ghost is a gorgeous blogging platform supported on Developer+ accounts on v6+ platforms. Ghost requires terminal access to deploy and hooks into Passenger affording simple process management.

Basic layout from a fresh Ghost install

Basic layout from a fresh Ghost install

 

Quickstart

This guide is designed to get Ghost up and running with the fewest steps. Ghost will be SQLite as a database backend, but you might want to configure it to take advantage of MySQL’s improved throughput.

  1. Login to the terminal
  2. Create a subdomain to serve Ghost. Since it’s launched with Passenger, you will need to make a Passenger-compatible filesystem layout
    • cd /var/www
      mkdir -p ghost/{tmp,public}
      cd ghost
  3. Download Ghost from ghost.org. At the time of writing, 0.6.4 is the latest version:
    • wget https://ghost.org/zip/ghost-0.6.4.zip
      unzip ghost-0.6.4.zip
      rm -f ghost-0.6.4.zip
  4. Ghost has been downloaded and extracted to /var/www/ghost. Ghost is a Node.js application that relies on third-party dependencies to run. These can be installed used the Node.js package manager (npm)
    • Install missing dependencies:
      npm install --production 
  5. Connect public/ to a subdomain within the control panel under WebSubdomains

    Connecting Ghost to a subdomain within the control panel.

    Connecting Ghost to a subdomain within the control panel

  6. Create a .htaccess control file in public/ and set PassengerNodejs to inform the web server that this is a Node.js application to be launched with Passenger. `which node` is shorthand to resolve the location of your Node interpreter as selected by nvm:
    • echo "PassengerNodejs `which node`" >> public/.htaccess
  7. Create a MySQL database. Ghost connects over TCP socket, so ensure that remote permissions on 127.0.0.1 are granted to the user. By default, when a user is created, permissions are only granted to “localhost” and not 127.0.0.1.
  8. Edit core/server/config/env/config.production.json with your database credentials. Change user, password, and database fields.
    • nano core/server/config/env/config.production.json
  9. Populate the database
    • env NODE_ENV=production knex-migrator init
  10. Finally, Passenger expects the entry-point to be named “app.js“. Ghost uses index.js as its startup file. Create a symbolic link from index.js to app.js to satisfy Passenger:
    • ln -s index.js app.js
  11. Once done, access /signup on the subdomain to setup your admin account
    • For example, in this walkthrough, the URL on ghost.example.com would be http://ghost.example.com/ghost
  12. Enjoy!

    Ghost administrative dialog after setup

    Ghost administrative dialog after setup

Odds and Ends

Restarting

Node.js piggybacks Passenger, and in doing so, can be easily restarted using the tmp/ control directory. Follow the general guide to restarting a Passenger-backed application.

See also

Updated on March 7, 2021

Related Articles