What is Ghost?

Ghost is a modern, open-source blogging platform which is excellent for online publishing. Ghost is very cutomizable and multiple themes that one can buy and use. You can also make your own Ghost themes. One particular example of a company using Ghost to publish their blog is Cloudflare. In fact, my own blog runs on Ghost! Ghost has a beauitiful online editor to type and publish articles, and makes use of easy-to-use Markdown language.

Where to use Ghost?

Ghost is best used to manage and publish blogs. I would personally recommend Ghost over Wordpress for blogging as Wordpress has evolved into more of a Content Management System than a simple blogging platform. I personally also think that Ghost is WAY more beautiful for publishing articles.

Step-by-step guide

Assumption: You have a non-root account with root/sudo privileges. This is usually the case in Ubuntu 16.04. Ghost does not work if you run the program as root. Additionally, DO NOT create a ghost user.

  1. First, update and upgrade your system
    sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade

  2. Install NGINX or Apache webserver
    sudo apt-get install -y nginx or sudo apt-get install -y apache2
    I will be using Apache Web Server as I personally think it is easier to maintain for new users.

  3. Install MySQL
    sudo apt-get install mysql-server -y
    Make sure to set a good root password

  4. (Recommended) Make your MySQL installation secure
    mysql_secure_installation
    Make sure to remove all th default users and tables

  5. Install NodeSource APT repository
    curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash
    WARNING: Newer versions of Nodejs (newer than 8.9) don't work as of the time of writing this article

  6. Install Node.js
    sudo apt-get install nodejs -y

  7. Install the Ghost-CLI
    sudo npm i -g ghost-cli

  8. Create a folder for Ghost
    sudo mkdir -p /var/www/ghost

  9. Change ownership for your Ghost folder to the user with sudo privileges
    sudo chown [user]:[user] /var/www/ghost

  10. Change the permissions of the Ghost folder
    sudo chmod 755 /var/www/ghost

  11. Navigate to the folder
    cd /var/www/ghost/

  12. Install Ghost
    ghost install

  13. Go through the prompts. For the URL, use the domain name that you want the blog to be available at. DO NOT configure NGINX if you intend to use Apache. Otherwise, select yes in the NGINX option

  14. Use ghost start in the directory to start the blog if it isn't running already. By default, Ghost natively operates on port 2368

  15. If you used Apache, create a new VirtualHost for the blog. Add the following lines to the http/https config (Assuming you have all the mods for reverse proxy enabled for Apache):

    <VirtualHost *:80> #Use 443 for HTTPS config file
    ServerName <your-domain-name-for-blog>
    ServerAlias <Alternate-domain-name-for-blog> #Optional
    
    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:2368/
    ProxyPassReverse / http://127.0.0.1:2368/
    
    </VirtualHost>
    
  16. You should be done now! You can go to http://<domain-name>/ghost to access the admin panel for ghost, tweak all of its features!