How to Install & Setup Ghost on Ubuntu

How to Install and Setup Ghost on Ubuntu

Have you ever thought about starting an elegant and minimalistic blog and found it costly to buy membership plans from the blogging platforms like Ghost? Well, I thought that too and figured out a way to self-host a blog using the Ghost blogging platform for as low as 5USD per month with Skysilk. In this blog post, we will cover how to install and setup Ghost on Ubuntu and installing Ghost-CLI.

There are a few reasons to consider installing and setting up Ghost on Ubuntu as your blogging platform. To run it efficiently and to maximize these benefits, keep these requirements in mind.

Ghost features

  • Unlike WordPress, Ghost uses Node.js instead of PHP.
  • Ghost is an open source software 
  • It offers tons of integrations such as Slack, Stripe, Google analytics and lots more
  • SEO meta tags and social media optimization is an inbuilt feature 
  • Is a very lightweight and fast blogging platform

Requirements

  • A VPS server with >1 GB RAM
  • Ubuntu 16.04 or 18.04
  • Nginx
  • A supported version of Node.js
  • MySQL
  • A domain name pointing its A records to your VPS server’s public IP address

SETUP DNS

You should add an “AAAA” record in your DNS manager if you have a server that only has an IPv6. In case you also have IPv4, add an A record in your DNS manager. Below is the example of DNS records, you can replace them with your server IP addresses.

A @ 100.100.100.100

AAAA @ 2001:0db8:85a3:0000:0000:8a2e:0370:7334

Login to SSH with root

ssh [email protected]

Install Nginx

Nginx is one of the essential requirements to be able to install Ghost blogging platform on your VPS server. Usually we install Nginx on our VPS server followed by server blocks setup. But in this process, we need not set up server blocks right now. 

Read more: Apache vs Nginx | Choosing the Best Open Source Web Server for You

Setup Database

Ghost platform requires MySQL server on your VPS to be able to function. You need to install the MySQL server first and then setup the database, database user and grant the user permissions to use that database.  

  • MySQL server will be installed
  • Essential setup after installing MySQL server on your VPS
  • Login to your MySQL server with the root user

Read more: How To Connect An Android App To A MySQL Database

  • Replace ‘ghostdb’ with your preferred database name
  • Replace ‘ghostusr’ with your desired username and ‘ghostpassword’ with your strong password. If you enable the validate password module in the secure mySQL installation, you will have to make sure that your password complies with your password policy.
  • Next, Give permissions to the newly created user to the database with the following command.

Install Node.js

As I mentioned before, the Ghost blogging platform uses node.js. Therefore, you need to install the supported version of Node. 

You can check all the supported versions of Node.js for Ghost here.

Before using curl command, make sure that it is already installed on your server. 

If the command returns the server’s configuration details, skip the next command. 

Install Ghost CLI

Ghost-CLI is a command-line interface that lets you perform a wide range of actions in the Ghost platform installation. You can easily install, uninstall and troubleshoot your ghost instance on your server using the Ghost-CLI.

Setup the installation directory

Now you have installed the required stack to install Ghost blogging platform. However, here you will decide where you want ghost to keep the files.

  • Replace ghostsecure with the directory name you want for your Ghost installation.
  • A properly configured Ghost install may not work if you fail in giving the right permissions. Use below command to set the permissions.

Install Ghost

When you run the above command, it will ask you a few questions to set up everything for you. 

Blog URL: https://yourdomain.com replace with your blog’s domain name

SQL hostname: localhost

SQL user: ghostusr replace with your database username

SQL password: ghostpassword replace with your database password

Setup Nginx: Y

SSL: Y

SSL email: [email protected] replace with your email address

Systemd: Y

Start Ghost?: Y

You need not worry about the SSL certificate for your ghost blog because the ghost-cli will automatically create an SSL certificate for you. This SSL certificate is configured using Letsencrypt. You need to make sure that you type in the right email address because your server will use that email to send you notifications if anything happens with your SSL certificate; such as renewals.

On the other hand, Nginx server blocks will also be set up when you say yes to setup Nginx during the setup process.

Read more: How to Host a Minecraft Server on Ubuntu

Conclusion

Installing and setting up Ghost on Ubuntu is fairly simple. After a successful installation and setup of the Ghost blogging platform on Ubuntu, you should be able to set up the admin user by visiting yourdomain.com/ghost. Furthermore, after installing Ghost-CLI, you can now visit your website, change the theme, customize it and start blogging on one, of the most minimalistic and elegant blogging platforms.

About the author: Vashishtha Kapoor is a Digital Marketing enthusiast and has over 5 years of experience in SEO, PPC, Website Management and WordPress development. Vashishtha writes about WordPress customizations, website designing, technology trends, and ad-tech topics.

(Visited 176 times, 1 visits today)

Share this post with your friends

Share on facebook
Share on twitter
Share on linkedin