The Ghost CMS is becoming more and more popular, and whilst it offers an out-of-the-box, hosted solution; if you want full control, it's better to self-host.
In this article we'll install Ghost on the latest version of Ubuntu (20.04), and although it states on the website that it only supports up until 18.04, if you follow this guide fully, you'll have no problems.
Also, if you're interested in a local->production git workflow, there's a link at the bottom of the page with a full walkthrough.
This guide implies you've already set up your Ubuntu 20.04 (or 18.04) server.
If you haven't, I recommend using Linode... super reliable! (p.s that link has my referral code)
Create a new user and give sudo privileges
# login ssh root@your_server_ip # replace <user> with a new username of your choice # create user adduser <user> # give admin privileges to the new user usermod -aG sudo <user> # log in as new user su - <user>
Update server packages
# Update package lists sudo apt-get update # Update installed packages sudo apt-get upgrade
Install Nginx & allow through firewall
# Install Nginx by running: sudo apt-get install nginx # allow Nginx through the firewall: sudo ufw allow 'Nginx Full'
Install MySQL Server
sudo apt-get install mysql-server
Make MySQL Server compatible with ghost-cli (remember to update the password
sudo mysql # update 'password' with a new password and keep the quotation marks ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; quit;
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash sudo apt-get install -y nodejs
sudo npm install ghost-cli@latest -g
Create a directory for you installation
# replace <sitename> with your site, i.e adamthedev.com sudo mkdir -p /var/www/<sitename> # Replace <user> with the name of your user who will own this directory sudo chown <user>:<user> /var/www/<sitename> # set permissions sudo chmod 775 /var/www/<sitename> # change to that directory cd /var/www/<sitename>
You'll now be prompted with a few questions. Here's what you should answer:
System checks failed with message: 'Linux version is not Ubuntu 16 or 18'
Some features of Ghost-CLI may not work without additional configuration.
For local installs we recommend using
ghost install localinstead.
Hit enter to continue
Enter your blog URL: https://<yourwebsiteurl> (i.e https://adamthedev.com) Enter your MySQL hostname: localhost Enter your MySQL username: root Enter your MySQL password: <your root mysql password> Do you wish to set up "ghost" mysql user? NO **SUPER IMPORTANT** Do you wish to set up Nginx? Yes Do you wish to set up SSL? Yes Enter your email (For SSL Certificate) <youremail> Do you wish to set up Systemd? Yes Do you want to start Ghost? Yes
You should now be able to access your website via your server ip or domain name (if it's configured).
To access the admin area go to <yoursite>/ghost
For more articles like this, remember to hit subscribe and be updated as soon as I post any nee content.
If you have any problems, leave a comment below and I'll try my best to help!