Don't worry you don't need to call the ghost busters! Ghost is a simple, open source, platform for modern blogging. In fact this site itself is running off of Ghost and so that is why this first post will explain now to get an instance of Ghost up and running.
- A Linux Server (In the case of this site an Ubuntu 16.04 EC2 server on Amazon AWS)
- A Domain Name (socialtea.io is a Route 53 domain name again through Amazon AWS). For more information check out this post
- A Terminal Emulator (Hyper is a personal favorite)
Once you have assembled all the above resources you are ready to dive into installing the server.
Depending on your server provider and server type there may or may not be the following already installed. After using SSH to connect to the server, run the following Ubuntu commands (or their equivilent for other Linux Distros) to install the needed software for supporting Ghost.
Update Ubuntu to the latest
sudo apt-get update
Install MySQL Database to store your content
sudo apt-get install mysql-server
Connect to the newly installed MySQL server and create a new user for Ghost
sudo mysql mysql> CREATE USER 'ghost'@'localhost' IDENTIFIED BY '<make_up_a_password'; mysql> GRANT ALL PRIVILEGES ON * . * TO 'ghost'@'localhost'; mysql> FLUSH PRIVILEGES;
exit to exit MySQL
Install Nginx as a reverse proxy server
sudo apt-get install nginx
Start Nginx and enable it on system restart
sudo systemctl start nginx sudo systemctl enable nginx
sudo apt-get install nodejs sudo apt-get install npm
After completing these steps you should be able to now install Ghost
First we are going to need to download the ghost-cli tool which will configure and run the needed server.
sudo npm i -g ghost-cli
Next create a directory to hold the installed files
Then change the ownership and permissions of the newly created directory
sudo chown $USER:$USER /var/www/ghost && chmod 775 /var/www/ghost
Change directory to the new ghost directory
And now use the ghost cli that we just installed to install the ghost server and download the needed files
Once the files are downloaded and installed there will be a series of prompts to configure the new instance
? Enter your MySQL hostname: *localhost* ? Enter your MySQL username: *ghost* ? Enter your MySQL password: *password that was set in mysql install* ? Enter your Ghost database name: *ghost_prod*
After that Ghost will finish setting up and configuring it then a few more prompts will show up. The first is to setup a mysql user which we already did so there is no need for it here. Then the installer will setup the needed configuration files for the Nginx proxy server which is great because those configs can be a pain to setup manually. Next the installer will ask to setup SSL for you via the Let's Encrypt certbot which is also convienent because it can be tricky to manully configure SSL certificates. Finally the setup will configure Systemd so that Ghost can run in the background without a user logged in. Without this the server would shut off when you disconnect the SSH session.
? Do you wish to set up "ghost" mysql user? *No* // We already did ? Do you wish to set up Nginx? *Yes* ? Do you wish to set up SSL? *Yes* ? Enter your email (used for Let's Encrypt notifications) *email@example.com* ? Do you wish to set up Systemd? Yes ? Do you want to start Ghost? Yes
After answering yes to the final prompt your new Ghost server should be up and running on the domain name that you configured!