How to Install Ghost on Ubuntu 22.04

how to install ghost on ubuntu 22.04

In this tutorial, we are going to show you how to install Ghost on Ubuntu 22.04 OS

Ghost is a free and open-source content management system (CMS) used for hosting a website. It is mainly used for publishing newsletters, articles, blog post content and etc. Ghost relies entirely on JavaScript, and the server side uses Node.js while the admin interface uses Ember.js. The data is stored in the MySQL database. In this blog post, we will install the Nginx web server along with MySQL required for Ghost to function properly.

Installing Ghost on Ubuntu 22.04 is a very straightforward process and may take up to 15 minutes. Let’s get things done!


  • Fresh install of Ubuntu 22.04
  • A valid domain pointed to the server IP address
  • User privileges: root or non-root user with sudo privileges

Step 1. Update the System

Before we start with Ghost installation, we will update the system packages to the latest versions available.

sudo apt update -y && sudo apt upgrade -y

Step 2. Install Nginx

To install the Nginx web server execute the following command:

sudo apt-get install nginx -y

After successful installation, the Nginx service will be automatically started. To check the status of Nginx, execute the following command:

sudo systemctl status nginx

You should get the following output:

root@host:~# sudo systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-12-28 15:27:57 CST; 10s ago
       Docs: man:nginx(8)
    Process: 8663 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 8664 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 8760 (nginx)
      Tasks: 4 (limit: 4575)
     Memory: 4.8M
        CPU: 50ms
     CGroup: /system.slice/nginx.service

Step 3. Install MySQL server

To install MySQL execute the following command:

sudo apt install mysql-server -y

Once installed, start and enable the MySQL service:

systemctl start mysql.service && systemctl enable mysql.service

To check the status of the service:

systemctl status mysql.service

If everything is ok, you should get the following output:

root@host:~# systemctl status mysql.service
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-12-28 15:32:20 CST; 13s ago
   Main PID: 9547 (mysqld)
     Status: "Server is operational"
      Tasks: 39 (limit: 4575)
     Memory: 364.1M
        CPU: 1.258s
     CGroup: /system.slice/mysql.service
             └─9547 /usr/sbin/mysqld

Step 4. Create a Ghost database and user

Next, we need to create a Ghost database, the Ghost user, and grant the permissions for that user to the database.

 CREATE USER 'ghost'@'localhost' IDENTIFIED BY 'YourStrongPasswordHere';
 GRANT ALL PRIVILEGES ON ghost.* TO 'ghost'@'localhost';

Step 5. Install Nodejs and npm

To install nodejs and npm, execute the following commands:

curl -sL | sudo -E bash

sudo apt-get update

sudo apt-get install nodejs

sudo npm install npm@latest -g

You can check the versions of Nodejs and NPM with the following command:

node --version && npm --version

You will get the following output:

root@host:~# node --version && npm --version

Step 6. Install Ghost-CLI and Ghost

First, we need to install the Ghost client command line tool, so we can install Ghost later:

sudo npm install -g ghost-cli@latest

To check the Ghost client version, execute the following:

ghost -v

You will get the following output:

Ghost-CLI version: 1.23.1

Now, when we have all dependencies installed, we can finally install Ghost. To create a Ghost user:

Need a fast and easy fix?
Unlimited Managed Support
Supports Your Software
2 CPU Cores
50 GB PCIe4 NVMe Disk
1854 GeekBench Score
Unmetered Data Transfer

Now just $43 .99

adduser ghostuser

usermod -aG sudo ghostuser

Login with the newly created Ghost user, create a ghost directory, and set the right permission:

su - ghostuser

sudo mkdir -p /var/www/ghost

sudo chown ghostuser:ghostuser /var/www/ghost

sudo chmod 775 /var/www/ghost

Go into the Ghost directory and install Ghost with the following command:

cd /var/www/ghost/

ghost install

The installation will start, and you will be asked to specify the domain name, MySQL host, database name, database user, password and to confirm the Nginx web server, SSL certificate and etc.

✔ Checking system Node.js version - found v16.19.0
✔ Checking logged in user
✔ Checking current folder permissions
✔ Checking system compatibility
✔ Checking for a MySQL installation
✔ Checking memory availability
✔ Checking free space
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v5.26.3
✔ Finishing install process
? Enter your blog URL:
? Enter your MySQL hostname: localhost
? Enter your MySQL username: ghost
? Enter your MySQL password: [hidden]
? Enter your Ghost database name: ghost
✔ Configuring Ghost
✔ Setting up instance
+ sudo useradd --system --user-group ghost
+ sudo chown -R ghost:ghost /var/www/ghost/content
✔ Setting up "ghost" system user
ℹ Setting up "ghost" mysql user [skipped]
? Do you wish to set up Nginx? Yes
+ sudo mv /tmp/yourdomain-com/ /etc/nginx/sites-available/
+ sudo ln -sf /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
+ sudo nginx -s reload
✔ Setting up Nginx
? Do you wish to set up SSL? (Y/n) Y
? Enter your email (For SSL Certificate)
+ sudo mkdir -p /etc/letsencrypt
+ sudo ./ --install --home /etc/letsencrypt
+ sudo /etc/letsencrypt/ --issue --home /etc/letsencrypt --server letsencrypt --domain --webroot /var/www/ghost/system/nginx-root --reloadcmd "nginx -s reload" --accountemail
+ sudo openssl dhparam -dsaparam -out /etc/nginx/snippets/dhparam.pem 2048
+ sudo mv /tmp/ssl-params.conf /etc/nginx/snippets/ssl-params.conf
+ sudo mv /tmp/yourdomain-com/ /etc/nginx/sites-available/
+ sudo ln -sf /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
+ sudo nginx -s reload
✔ Setting up SSL
? Do you wish to set up Systemd? (Y/n) Y
? Do you wish to set up Systemd? Yes
+ sudo mv /tmp/yourdomain-com/ghost_yourdomain-com.service /lib/systemd/system/ghost_yourdomain-com.service
+ sudo systemctl daemon-reload
✔ Setting up Systemd
+ sudo systemctl is-active yourdomain-com
? Do you want to start Ghost? Yes
+ sudo systemctl start ghost_yourdomain-com
☱ Starting Ghost
Ghost uses direct mail by default. To set up an alternative email method read our docs at


Ghost was installed successfully! To complete setup of your publication, visit:

After successful installation, you can access the website at to define the name of the website and set up the login credentials.

ghost set credentials

Once done, click on the black button “Create account & start publishing ->

ghost start publishing

That’s it; you successfully installed and configured Ghost on Ubuntu 22.04. Of course, you do not have to do this if you find the setup complex. You can always contact our Technical support. We are available 24/7 and will help you with any Ghost installation and configuration aspect.

If you liked this about installing Ghost on Ubuntu 22.04, please share it with your friends on social networks or simply leave a reply below. Thanks.

Leave a Comment

To prove you are human please solve the following *