Launch Friday Monks Using Ghost on a Ubuntu EC2 Instance
In this post we will look at launching a Ghost CMS instance on an AWS EC2 machine.
Install ghost⌗
# install ghost
sudo npm install ghost-cli@latest -g
Need a different user: calling it ibbur
(Apparently a ghost name!).
Ghost doesn’t install when the login name itself is ghost
!!
sudo useradd -d /home/ibbur -m ibbur
sudo passwd ibbur
sudo adduser ibbur www-data
sudo adduser ibbur sudo
# change directory
cd ~/Dropbox/pandora/My-Projects/repos/
# create a directory for the ghost site
mkdir -p friday_monks
# change user
sudo su - ibbur
# note: change to the directory of installation
# set permissions for ibbur
sudo chown -R $USER:$USER friday_monks/
# change directory
cd friday_monks
# install ghost
ghost install --db sqlite3
Refer to Ghost CLI documentation for more information.
Troubleshooting⌗
Ghost installation runs into issues due my hyper weird already existing ubuntu username! Too lazy to change. Lets do a workaround now!
We basically will break down the setup stages and handle it manually as mentioned at Ghost-CLI commands: setup - Documentation
Reclaim Permissions! :-)⌗
# change back to ghost
whoami
cd ..
# change permissions back to ghost
sudo chown -R $USER:$USER friday_monks/
Setup NGINX⌗
ghost setup nginx
Done!
![Screenshot 2020-11-01 at 7.00.50 PM](/images/Screenshot 2020-11-01 at 7.00.50 PM.png)
Setup SSL⌗
# Creates an SSL service for Ghost
ghost setup ssl
This ran into errors! :-(
I’ve done this before. This should work!
sudo certbot --authenticator standalone --installer nginx -d www.fridaymonks.com --pre-hook 'service nginx stop' --post-hook 'service nginx start'
This too ran into issues! But, the info here was more meaningful! I need to set the DNS Servers!
After settting up the DNS, the SSL setup worked flawlessly!
ghost setup ssl
Setup systemd
⌗
ghost setup systemd
Re-setup ghost⌗
cd current
# reinstall node modules
npm i
Test ghost⌗
Environment="NODE_ENV=production"
ExecStart=/home/ghost/.nvm/versions/node/v12.19.0/bin/node /home/ghost/.nvm/versions/node/v12.19.0/bin/ghost run
Troubleshooting NGINX⌗
The ghost-cli config didn’t work smoothly for me. I had manually configure nginx, symlink the site and restart ghost!
Everything worked well thereafter!
Launch⌗
Upload a great theme and the site is live at Friday Monks!