How to Install Ghost Blogging Platform on Ubuntu 24.04 Server

This tutorial will show you how to install the Ghost blogging platform on an Ubuntu 24.04 server. Ghost is an open-source blogging software coded in Node.js, allowing you to create modern, beautiful blogs. Compared to WordPress, Ghost is lightweight and much faster because it’s built specifically for blogging and isn’t a comprehensive content management system like WordPress.

Ghost Features

At the time of writing, the latest version of Ghost is v5.80.2, released on March 28, 2024. Features of Ghost are as follows:

  • A Markdown-based editor allows you to quickly write posts.
  • Simple content management.
  • Collaborative editing with your team.
  • Scheduled publishing
  • Built-in analytics
  • Proper SEO is built in directly, with semantic markup, permalinks, XML sitemaps, canonical tags, and automatic metadata with manual overrides.
  • Integrated AMP (Accelerated Mobile Pages) support
  • Full RSS feeds, email subscription capture forms, and Slack webhook integration
  • Hundreds of beautiful free and premium themes are available from the Ghost marketplace
  • A nice-looking default theme Casper with dark mode support.
  • A cross-platform desktop app is available for Linux, Mac, and Windows.
  • The official Ghost Migrator WordPress plugin allows you to easily migrate from WordPress to Ghost.

The Ghost foundation offers managed hosting, but here we will see how to create a self-hosted Ghost blog on Ubuntu server.

install ghost blog on ubuntu server


To run a Ghost blog, you need a server with at least 1GB of RAM. I recommend Kamatera VPS (Virtual Private Server), which features:

  • 30 days free trial.
  • Starts at $4/month (1GB RAM)
  • High-performance KVM-based VPS
  • 9 data centers around the world, including the United States, Canada, UK, Germany, The Netherlands, Hong Kong, and Isreal.

Follow the tutorial linked below to create your Linux VPS server at Kamatera. For best compatibility, please use the LTS version of Ubuntu like Ubuntu 24.04.

Once you have a VPS running Ubuntu, follow the instructions below.

You also need to have a domain name. I registered my domain name from NameCheap because the price is low and they give whois privacy protection free for life.

Note: I installed Ghost with a sudo user on Ubuntu. For best results, you should also follow this tutorial with a sudo user, not root. To add a sudo user, simply run

sudo adduser username
sudo adduser username sudo

Then switch to the new user.

su - username

Step 1: Update Ubuntu

If your server hasn’t been updated for some time, then run the following command to update existing software packages.

sudo apt update;sudo apt upgrade -y

Step 2: Install Node.js on Ubuntu

Ghost requires you to install the LTS version of Node.js and does not support non-LTS version. The latest version of Node.js is v22.x, but currently, Ghost is more compatible with Node.js v18.x. Add NodeSource repository using the command below.

curl -sL | sudo -E bash -

Then install Node.js.

sudo apt install -y nodejs

Check Node version.

node -v

Sample output:


Check npm version:

npm -v

Sample output:


Step 3: Install MariaDB Database Server

Ghost supports MySQL and MariaDB. MariaDB is a drop-in replacement for MySQL. It is developed by former members of MySQL team who are concerned that Oracle might turn MySQL into a closed-source product. So let’s install the MariaDB database server.

Enter the following command to install it on Ubuntu 24.04.

sudo apt install mariadb-server mariadb-client

After it’s installed, MariaDB server should be automatically started. Use systemctl to check its status.

systemctl status mariadb

Sample output:

 mariadb.service - MariaDB 10.11.7 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2024-05-04 11:13:27 UTC; 21s ago
     Docs: man:mysqld(8)
 Main PID: 3473 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 27 (limit: 505)
   CGroup: /system.slice/mariadb.service
           └─3473 /usr/sbin/mysqld

If it’s not running, start it with this command:

sudo systemctl start mariadb

To enable MariaDB to automatically start at system boot time, run

sudo systemctl enable mariadb

Now run the post-installation security script.

sudo mysql_secure_installation
  • When it asks you to enter MariaDB root password, press Enter key as the root password isn’t set yet.
  • Don’t switch to unix_socket authentication because MariaDB is already using unix_socket authentication.
  • Don’t change the root password, because you don’t need to set root password when using unix_socket authentication.
ubuntu 22.04 install LEMP stack

Next, you can press Enter to answer all remaining questions, which will remove anonymous user, disable remote root login and remove test database. This step is a basic requirement for MariaDB database security. (Notice that Y is capitalized, which means it is the default answer. )


Check MariaDB server version information.

mariadb --version


mariadb Ver 15.1 Distrib 10.11.7-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper

Step 4: Create a Database and User for Ghost

Now we need to log in to the MariaDB console and create a database and user for Ghost.

sudo mariadb -u root

Create a database for Ghost using the following command. I named it ghost, but you can use whatever name you like. (Don’t leave out the semicolon.)

create database ghost;

Then enter the command below to create a database user for Ghost and grant all privileges of the ghost database to the user.

grant all privileges on ghost.* to ghost@localhost identified by 'ghost_password';

Flush the privileges table for the changes to take effect and then log out of the MariaDB console.

flush privileges;


Step 5: Install Nginx Web Server

Ghost will use Nginx web server, so run the following command to install it from the default Ubuntu repository.

sudo apt install nginx

If you are using the UFW firewall, then you also need to open ports 80 and 443.

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

Step 6: Create A Record For Your Blog Domain Name

Before installing Ghost, it’s recommended that you create the DNS A record for your blog domain name. The A record points your domain name to the IP address of your Ubuntu server.

Step 7: Install Ghost on Ubuntu Server

Run the following command to install Ghost-CLI.

sudo npm install ghost-cli@latest -g

Then create a directory (/var/www/ghost/) for Ghost.

sudo mkdir -p /var/www/ghost/

Grant permissions to your user account. Replace username with your real username.

sudo apt install acl

sudo setfacl -R -m u:username:rwx /var/www/ghost/

sudo chmod 775 /var/www/ghost

Now change the working directory to /var/www/ghost/ and install Ghost.

cd /var/www/ghost/

ghost install

This command will check if your server environment meets the requirements, then install all dependencies.

ghost install ubuntu 24.04 server

During the installation, you will be asked to enter your blog URL. Enter something like And you will need to enter the MariaDB database name, and user credentials you created in step 4.

? Enter your blog URL:
? Enter your MySQL hostname: localhost
? Enter your MySQL username: ghost
? Enter your MySQL password: ghost_password
? Enter your Ghost database name: ghost

A ghost system user will be automatically created.

  • It’s recommended that you accept to set up Nginx and SSL, so your blog will be available via the secure HTTPS protocol.
  • Also, accept to set up the Systemd service so you will be able to start, stop or restart Ghost easily.

If you encounter the “Nginx is not installed. Skipping Nginx setup” error, please go to the Troubleshooting section at the end of this article to manually create the Nginx config file for Ghost.

Once Ghost was installed successfully, go to to complete the setup. First, you need to create an account.

ghost setup wizard

Then you can invite some staff users to your Ghost blog, or you can do it later.

Step 8: Edit the Nginx Config File

By default, the Nginx configuration file for Ghost contains one domain name. If you want Nginx to serve both the www domain and the non-www domain, edit the configuration file.

sudo nano /etc/nginx/sites-enabled/

Find the following line


Add the www domain.


Save and close the file. Then delete the /etc/nginx/sites-enabled/ file.

sudo rm /etc/nginx/sites-enabled/

Then install the Certbot Let’s Encrypt client

sudo apt install certbot python3-certbot-nginx

Obtain an SSL certificate for both the www domain and the non-www domain.

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d,

Restart Nginx and you are done.

sudo systemctl restart nginx

Step 9: Set Up Email Notification

In order to send emails from your Ghost blog (for password resetting, inviting staff users, member signup, etc), you need to configure the SMTP settings. There are two options:

  • Use an SMTP relay service (easier)
  • Set up your own email server (takes more time)

SMTP Relay

If you would like to use an SMTP relay service, follow the tutorial linked below to set up Postfix SMTP relay on Ubuntu server.

Once that’s done, edit the Ghost configuration file.

sudo nano /var/www/ghost/config.production.json

By default the mail settings are as follows:

"mail": {
   "transport": "Direct"

Change it to:

  "mail": {
    "transport": "Sendmail",
    "from": ""

Save and close the file. Then restart Ghost via the systemd service.

sudo systemctl restart ghost_yourdomain-com.service

Now your Ghost blog should be able to send emails.

Use your own email server

If you would like to use your own email server, please read the following tutorial to easily set up your own email server.

Once you have your own email server, edit the Ghost configuration file.

sudo nano /var/www/ghost/config.production.json

By default the mail settings are as follows:

"mail": {
   "transport": "Direct"

Change it to use SMTP.

"mail": {
    "transport": "SMTP",
    "from": "[email protected]",
    "options": {
        "service": "",
        "host": "",
        "port": 465,
        "secureConnection": true,
        "auth": {
            "user": "[email protected]",
            "pass": "the_email_account_password"

Note that Ghost doesn’t support port 587 for SMTP. Save and close the file. Then restart Ghost via the systemd service.

sudo systemctl restart ghost_yourdomain-com.service

Now your Ghost blog should be able to send emails.

Troubleshooting: How to Manually Set Up Nginx for Ghost

If during the installation you encounter the “Nginx is not installed. Skipping Nginx setup” error, then you need to manually create Nginx config file.

sudo nano /etc/nginx/conf.d/ghost.conf

Add the following lines in this file.

server {
    listen [::]:80;
    listen 80;
    root /var/www/ghost/;
    access_log /var/log/nginx/ghost.access.log;
    error_log /var/log/nginx/ghost.error.log;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header HOST $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_redirect off;

    # allow Let's Encrypt checks on .well-known without proxying
    location ~ /.well-known {
        allow all;

Save and close the file. Then Nginx configurations.

sudo nginx -t

If the test is successful, reload Nginx.

sudo systemctl reload nginx

In order to obtain a valid TLS certificate, we install the Certbot Let’s Encrypt client.

sudo apt install certbot python3-certbot-nginx

Obtain a TLS certificate for both the www domain and the non-www domain.

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d,

Restart Nginx and you are done.

sudo systemctl restart nginx

Wrapping Up

That’s it! I hope this tutorial helped you install Ghost blog on Ubuntu 24.04 server. As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 1 Average: 5]

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community ( for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here