How To Install Ghost on Ubuntu 22.04 - A Step-by-Step Guide to Setting Up Your New Blog

While WordPress has reigned king for quite a while in terms of content management systems, Ghost is catching on quickly for good reason. Here's why, and how to install it.

Publish date: 11/19/2023

Managing a website or blog becomes significantly easier with a content management system (CMS).

Who wants to handle every page individually? Not me.

While WordPress dominates a large portion of the internet due to its ease of use, it does have its drawbacks, such as the requirement of PHP and being resource intensive.

That's why many valid competitors to WordPress have popped up over the last few years...

Such as Ghost, a modern CMS that skips PHP (opting for Node.js instead), offering a sleek, fast, and user-friendly alternative for bloggers and web administrators.

Ghost represents a new era in CMS design, focusing on simplicity, speed, and an intuitive user experience.

It's not quite as easy to install as something like WordPress, though...

That's why the team over here at xTom made this blog post!

In it, we'll be showing you exactly how to install Ghost step-by-step, with the recommended Linux distribution, Ubuntu.

Let's dive in.

Step 1: Create a new user

First, we need a user other than root to run Ghost under:

adduser <user>

Avoid using the username ghost as it conflicts with Ghost-CLI.

Then add the user to the superuser group:

usermod -aG sudo <user>

Then log in as the new user:

su - <user>

Step 2: Update packages

Next, update your package lists and installed packages:

sudo apt-get update 
sudo apt-get upgrade

Step 3: Install Nginx

Now we'll need to install our web server:

sudo apt-get install nginx

Then configure UFW:

sudo ufw allow 'Nginx Full'` 

Step 4: Install MySQL

Next up, we need to install MySQL:

sudo apt-get install mysql-server

It should be noted that Ghost is not officially compatible with MariaDB.

Step 5: Install Node.js

Ghost uses Node.js instead of PHP, so we'll also need to install that (use a supported version, e.g., Node 18):

bash
sudo apt-get update sudo apt-get install -y ca-certificates curl gnupg curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list sudo apt-get update sudo apt-get install nodejs -y

Step 6: Install Ghost-CLI

Now we can install Ghost-CLI, the official Ghost management tool:

sudo npm install ghost-cli@latest -g

Step 7: Install Ghost

Next we'll need to create a new directory to install Ghost in:

sudo mkdir -p /var/www/sitename 
sudo chown <user>:<user> /var/www/sitename
sudo chmod 775 /var/www/sitename cd /var/www/sitename

Then finally the fun part!

Run ghost install and follow the CLI prompts to configure your site, including setting up Nginx, SSL, and systemd.

Installing Ghost on Ubuntu 22.04

For MySQL, you'll use your default root user and root password while installing.

I suggest also creating a separate MySQL user for Ghost while installing with Ghost-CLI.

Also, if you use an IP instead of a domain, you will receive an error here.

Congrats on the new Ghost blog!

After completing the installation using Ghost-CLI, you can go to yourdomain.com/ghost and you'll be greeted with a page that looks like this:

Ghost welcome screen

Proceed with following the self-explanatory steps, and you now have a new Ghost blog!

By the way: to keep Ghost updated in the future, you can simply run ghost update via terminal.

For more information surrounding Ghost and its commands and possibilities, run ghost help.

Troubleshooting

If the installation fails, use ghost uninstall to remove it and try again. For interrupted installations, use ghost setup to restart the configuration process.

We also suggest that you install Ghost on a fresh server, with only Ghost running on that server.

All of that being said...

Looking for a good host to run your Ghost blog on?

Look no further: xTom has you covered.

Regardless if you're looking to make a small blog for cheap that may be more likely viewed by you than anyone else, or, you're looking to run a large enterprise that receives hundreds of thousands of views per month, we can handle the job.

For starters, check out our VPS line here which can easily accomplish the task of hosting a Ghost blog and starts at as little as €6.95 monthly.

Then if you're still not sure what you need, or you just want a hand in deciding what's the right infrastructure for your new Ghost blog, feel free to reach out to our sales team here.

Thanks for reading, and here's to modern and optimized blogging platforms!