---
title: "Installing Ghost"
date: "2015-02-27"
category: "node"
slug: "installing-ghost"
---

Ghost is a blogging platform supported on [[is-terminal-access-available]] on [[determining-platform-version]] platforms. It requires [[accessing-terminal]] access and hooks into Passenger for process management.

![Basic layout from a fresh Ghost install](kb-image:ghost-first-post.png)
*Basic layout from a fresh Ghost install*

## Quickstart

This guide uses SQLite as the default database backend. You may want to [configure Ghost](http://support.ghost.org/config/) to use MySQL for improved throughput.

1. Login to the [[accessing-terminal]]
2. Create a Passenger-compatible directory structure for Ghost:
    - cd /var/www
        mkdir -p ghost/{tmp,public}
        cd ghost

3. [Download Ghost](https://ghost.org/download/) from ghost.org (version 0.6.4 at time of writing):
    - wget https://ghost.org/zip/ghost-0.6.4.zip
        unzip ghost-0.6.4.zip
        rm -f ghost-0.6.4.zip

4. Install dependencies using npm:

    ```
    npm install --production 
    ```

5. Connect `public/` to a subdomain within the [[logging-into-the-control-panel]] under **Web** > **Subdomains**

    ![Connecting Ghost to a subdomain within the control panel.](kb-image:ghost-subdomain-assignment.png)
*Connecting Ghost to a subdomain within the control panel*

6. Create a [[htaccess-guide]] control file in `public/` to configure Passenger for [[running-node-js]]. Use `` `which node` `` to resolve the path to your Node interpreter as selected by [[changing-node-versions]]:
    - echo "PassengerNodejs \`which node\`" >> public/.htaccess

7. Create a [[creating-database]]. Ghost connects over TCP socket, so ensure that [[connecting-remotely-mysql]] on 127.0.0.1 are granted to the user. By default, new users only have permissions for "localhost", not 127.0.0.1.

8. Edit `core/server/config/env/config.production.json` with your database credentials (_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. Passenger expects the entry-point to be named `app.js`. Ghost uses `index.js`, so create a symbolic link:
    - ln -s index.js app.js

11. Access `/ghost` on your subdomain to set up the admin account (e.g., `http://ghost.example.com/ghost`)

    ![Ghost administrative dialog after setup](kb-image:ghost-admin-dialog.png)
*Ghost administrative dialog after setup*

## Restarting

Ghost runs through Passenger and can be restarted using the `tmp/` control directory. Follow the general [[restarting-passenger-processes]] guide.

## See Also

- [Ghost Website](https://ghost.org/)
- [Ghost Configuration](http://support.ghost.org/config/)
- [Ghost Documentation: Getting Started](http://support.ghost.org/getting-started/)
