Vultr DocsLatest Content

How to Install Ghost Blogging Platform on Ubuntu 24.04

Updated on 04 December, 2025
Install Ghost on Ubuntu 24.04 via Ghost-CLI or Docker Compose, proxy with Nginx, secure SSL using Certbot, enable analytics with Tinybird and federation using ActivityPub.
How to Install Ghost Blogging Platform on Ubuntu 24.04 header image

Ghost is an open-source publishing platform designed for bloggers, journalists, and content creators. It provides built-in newsletter functionality, membership management, and subscription features. Recent versions support ActivityPub federation for interaction with decentralized social networks and include web analytics through Tinybird integration.

This article explains how to install Ghost Blogging Platform on Ubuntu 24.04 using two methods: Ghost-CLI for a traditional installation and Docker Compose for containerized deployments with analytics capabilities.

Prerequisites

Before you begin, ensure you:

Install Ghost Using the CLI Method

The CLI method installs Ghost directly on the host system using Ghost-CLI. This requires you to install Node.js, MySQL, and Nginx as dependencies before installing Ghost.

Install Node.js

Ghost is compatible with Node v22 LTS. You can check the list of compatible Node versions for Ghost at the official documentation.

  1. Download and run the NodeSource setup script to install Node.js v22 LTS.

    console
    $ curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh
    $ sudo -E bash nodesource_setup.sh
    $ sudo apt install -y nodejs
    
  2. Verify the installed Node.js version.

    console
    $ node -v
    

    Output:

    v22.21.0

Install and Configure MySQL

  1. Install the MySQL Server.

    console
    $ sudo apt install -y mysql-server
    

    MySQL starts automatically and runs as a service.

  2. Verify the MySQL installation.

    console
    $ mysql --version
    

    Your output should be similar to the one below.

    mysql  Ver 8.0.43-0ubuntu0.24.04.2 for Linux on x86_64 ((Ubuntu))
  3. Secure the MySQL installation.

    console
    $ sudo mysql_secure_installation
    

    Follow the interactive prompts to improve MySQL security. The root account uses the auth_socket plugin by default, which authenticates based on the system user and does not require a separate password.

    • VALIDATE Password: Enter y to enable password validation for new database users.
    • Password Validation Policy: Enter 2 for strong password requirements (uppercase, lowercase, numbers, special characters).
    • Remove anonymous users: Enter y to remove anonymous access.
    • Disallow root login remotely: Enter y to restrict root access to localhost only.
    • Remove test database: Enter y to delete the test database.
    • Reload privilege tables: Enter y to apply changes immediately.
  4. Log in to the MySQL console.

    console
    $ sudo mysql
    
  5. Create a database, user, and grant privileges.

    sql
    mysql> CREATE DATABASE ghost_db;
    mysql> CREATE USER 'ghostuser'@'localhost' IDENTIFIED BY 'Your_password2!';
    mysql> GRANT ALL PRIVILEGES ON ghost_db.* TO 'ghostuser'@'localhost';
    mysql> FLUSH PRIVILEGES;
    mysql> EXIT;
    

Install Nginx Web Server

  1. Install Nginx.

    console
    $ sudo apt install -y nginx
    
  2. Allow HTTP and HTTPS traffic through the firewall.

    console
    $ sudo ufw allow 'Nginx Full'
    
  3. Verify Nginx is running.

    console
    $ sudo systemctl status nginx
    

Install Ghost

  1. Install the Ghost-CLI package globally.

    console
    $ sudo npm install ghost-cli@latest -g
    
  2. Create a directory for the Ghost installation.

    console
    $ sudo mkdir -p /var/www/html/ghost
    
  3. Set ownership to the current user.

    console
    $ sudo chown $USER:$USER /var/www/html/ghost
    
  4. Set directory permissions.

    console
    $ sudo chmod 775 /var/www/html/ghost
    
  5. Navigate to the Ghost directory.

    console
    $ cd /var/www/html/ghost
    
  6. Run the Ghost installation process.

    console
    $ ghost install
    

    The installer prompts for configuration details. Provide the following information:

    • Enter your blog URL: Your domain with HTTPS, e.g., https://ghost.example.com
    • Enter your MySQL hostname: localhost
    • Enter your MySQL username: The username created earlier (e.g., ghostuser)
    • Enter your MySQL password: The password set earlier (e.g., Your_password2!)
    • Enter your Ghost database name: The database created earlier (e.g., ghost_db)
    • Do you wish to set up Nginx?: Enter y to configure Nginx automatically
    • Do you wish to set up SSL?: Enter y to install acme.sh for SSL certificate management
    • Enter your email (For SSL Certificates): A valid email address for certificate notifications
    • Do you wish to set up Systemd?: Enter y to create a systemd service for Ghost
    • Do you want to start Ghost?: Enter y to start Ghost immediately

Manage Ghost Configuration

  1. To update any of the parameters, edit the configuration file below..

    console
    $ nano /var/www/html/ghost/config.production.json
    
  2. After changing the configuration, restart Ghost.

    console
    $ cd /var/www/html/ghost
    $ ghost restart
    
    • Alternatively, restart and view the status of Ghost using systemd. Replace ghost-example-com with your domain name.

      console
      $ sudo systemctl restart ghost_ghost-example-com.service
      $ sudo systemctl status ghost_ghost-example-com.service
      

      From the output, verify that the service is running.

Update Ghost

  1. Navigate to the Ghost installation directory.

    console
    $ cd /var/www/html/ghost
    
  2. Create a backup before updating. This command prompts for your sudo password and staff access token. You can find the staff access token under Settings > Staff > View Profile.

    console
    $ ghost backup
    
  3. Update Ghost to the latest version.

    console
    $ ghost update
    

    Ghost-CLI handles database migrations and applies all required changes, which may result in brief downtime.

    • To update to a specific version, replace VERSION with the desired release.

      console
      $ ghost update VERSION
      

Access and Configure Ghost

  1. Navigate to the Ghost admin panel at https://ghost.example.com/ghost.

    Ghost setup screen

  2. Complete the initial setup form with the following details:

    • Site title: Your blog or publication name
    • Full name: Your name (displayed as the author)
    • Email address: Admin account email
    • Password: A strong password for the admin account
  3. Click Create account & start publishing to complete setup.

  4. After setup, access the admin panel at https://ghost.example.com/ghost to:

    • Customize site design and branding
    • Create content and manage posts
    • Configure membership and subscription tiers
    • Set up integrations and custom code injection
    • Manage team members and permissions

Conclusion

You have successfully installed Ghost on Ubuntu 24.04 using either Ghost-CLI for traditional deployments or Docker Compose for containerized environments. Both methods provide a production-ready Ghost installation with SSL certificates, automated backups (CLI method), and optional web analytics through Tinybird integration. Ghost is now ready for content creation, newsletter distribution, and membership management.

Comments