This guide will demonstrate how to Install Ghost CMS on Debian 12/11/10 Linux distribution. Ghost is an open source publishing platform which is beautifully designed, easy to use, and free for everyone. It has full support for Markdown and provides an easy to use the web interface for administration purposes.

For CentOS / RHEL: Install and Configure Ghost CMS on CentOS / RHEL 7/8

Setup Requirements

For this setup, the basic requirements are:

  • Debian Linux server
  • Nginx Web Server
  • FQDN – e.g blog.example.com (have DNS A record pointing to your server FQDN)
  • Node.js installed
  • MySQL / MariaDB Database Server
  • ghost user – Non-root user to manage it

Let’s start installation of Ghost on Debian Linux machine.

Install and Configure database and Nginx

Install a database server for Ghost CMS. This can either be MySQL or MariaDB database server.

sudo apt update
sudo apt install mariadb-server

When done, Create the database for ghost blog you plan to add:

$ sudo mysql -u root -p
CREATE USER ghostcms@localhost IDENTIFIED BY "StrongDBPassword";
CREATE DATABASE  ghostcms; 
GRANT ALL ON ghostcms.* TO ghostcms@localhost;
FLUSH PRIVILEGES;
QUIT

Next is the installation of Nginx

sudo apt -y install nginx

Nginx systemd service is started automatically after installation:

$ systemctl status nginx
 nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; preset: enabled)
     Active: active (running) since Wed 2024-02-28 11:18:08 UTC; 6s ago
       Docs: man:nginx(8)
    Process: 2632 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 2633 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 2656 (nginx)
      Tasks: 2 (limit: 2251)
     Memory: 1.7M
        CPU: 34ms
     CGroup: /system.slice/nginx.service
             ├─2656 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
             └─2659 "nginx: worker process"

Feb 28 11:18:08 deb12 systemd[1]: Starting nginx.service - A high performance web server and a reverse proxy server...
Feb 28 11:18:08 deb12 systemd[1]: Started nginx.service - A high performance web server and a reverse proxy server.

Add User for Ghost administration

Add user called ghostadmin

sudo adduser ghostadmin
sudo usermod -aG sudo ghostadmin

Install Node.js on Debian

Configure Node.js 20 apt repository.

sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -

Install Node.js on Debian once the repository has been configured:

sudo apt install -y nodejs

Confirm Node version

$ node -v
v18.19.1

Install Ghost-CLI and configure Ghost

We now need to install the package ghost-cli which provides ghost command.

sudo npm i -g ghost-cli

Please note that:

  • Installing Ghost in the /root folder won’t work and result in a broken setup!
  • Installing Ghost in your /home/{user} folder won’t work and result in a broken setup!
  • Please only use /var/www/{folder} because it has the right permissions.

So let’s create this directory:

sudo mkdir -p /var/www/ghost
sudo chown ghostadmin:ghostadmin /var/www/ghost
sudo chmod 775 /var/www/ghost

Create Ghost CMS directory.

sudo su - ghostadmin
cd /var/www/ghost
mkdir blog.example.com
cd blog.example.com

Run the command below to install ghost:

$ ghost install
 ✔ Checking system Node.js version
 ✔ Checking logged in user
 ✔ Checking current folder permissions
 ✔ Checking operating system compatibility
 ✔ Checking for a MySQL installation
 ✔ Checking memory availability
 ✔ Checking for latest Ghost version
 ✔ Setting up install directory
 ✔ Downloading and installing Ghost v18.19.1
 ✔ Finishing install process
 ? Enter your blog URL: http://blog.example.com
 ? Enter your MySQL hostname: localhost
 ? Enter your MySQL username: ghostcms
 ? Enter your MySQL password: [hidden] StrongDBPassword
 ? Enter your Ghost database name: ghostcms
 ✔ Configuring Ghost
 ✔ Setting up instance
 sudo useradd --system --user-group ghost
 sudo chown -R ghost:ghost /var/www/ghost/blog.example.com/content
 ✔ Setting up "ghost" system user
 ? Do you wish to set up "ghost" mysql user? Yes
 MySQL user is not "root", skipping additional user setup
 ℹ Setting up "ghost" mysql user [skipped]
 ? Do you wish to set up Nginx? Yes
 ✔ Creating nginx config file at /var/www/ghost/blog.example.com/system/files/blog.example.com.conf
 sudo ln -sf /var/www/ghost/blog.example.com/system/files/blog.example.com.conf /etc/nginx/sites-available/blog.example.com.conf
 sudo ln -sf /etc/nginx/sites-available/blog.example.com.conf /etc/nginx/sites-enabled/blog.example.com.conf
 sudo nginx -s reload
 ✔ Setting up Nginx
 ? Do you wish to set up SSL? No
 ℹ Setting up SSL [skipped]
 ? Do you wish to set up Systemd? Yes
 ✔ Creating systemd service file at /var/www/ghost/blog.example.com/system/files/ghost_blog-example-com.service
 sudo ln -sf /var/www/ghost/blog.example.com/system/files/ghost_blog-example-com.service /lib/systemd/system/ghost_blog-example-com.service
 sudo systemctl daemon-reload
 ✔ Setting up Systemd
 ? Do you want to start Ghost? Yes
 sudo systemctl is-active ghost_blog-example-com
 ✔ Ensuring user is not logged in as ghost user
 ✔ Checking if logged in user is directory owner
 ✔ Checking current folder permissions
 sudo systemctl is-active ghost_blog-example-com
 ✔ Validating config
 ✔ Checking folder permissions
 ✔ Checking file permissions
 ✔ Checking content folder ownership
 ✔ Checking memory availability
 sudo systemctl start ghost_blog-example-com
 ✔ Starting Ghost
 sudo systemctl is-enabled ghost_blog-example-com
 sudo systemctl enable ghost_blog-example-com --quiet
 ✔ Enabling Ghost instance startup on server boot 
 Ghost uses direct mail by default. To set up an alternative email method read our docs at https://ghost.org/mail
 
 Ghost was installed successfully! To complete setup of your publication, visit: 
 http://blog.example.com/ghost/

This will install and start your blog in production mode using MySQL as the default database. You can Agree to setup Let's Encrypt SSL . If your server has a valid domain name and Public IP Address.

Nginx configuration files will be placed under: /etc/nginx/sites-enabled/

Check service status:

$ systemctl status ghost_blog-example-com
  ghost_blog-example-com.service - Ghost systemd service for blog: blog-example-com
    Loaded: loaded (/var/www/ghost/blog.example.com/system/files/ghost_blog-example-com.service; enabled; vendor preset: enabled)
    Active: active (running) since Sun 2023-01-30 17:06:48 EAT; 34min ago
      Docs: https://docs.ghost.org
  Main PID: 19723 (ghost run)
     Tasks: 18 (limit: 4915)
    CGroup: /system.slice/ghost_blog-example-com.service
            ├─19723 ghost run
            └─19734 /usr/bin/node current/index.js

Ghost Cheats:

Logs dir: /content/logs/
$ ghost start: Start ghost
$ ghost restart: Restart ghost
$ ghost run: Test if the ghost can start successfully
$ ghost uninstall: Re-install ghost
$ ghost update: Upgrade ghost
$ ghost update — force: Force upgrade if there are errors
$ ghost update –rollback: Revert to the earlier version if an upgrade fails
$ sudo npm i -g ghost-cli@latest: Upgrade Ghost-CLI
$ ghost ssl-renew: Renew ssl certificate
$ ls ./system/files/*.conf: System configuration files
$ ghost setup nginx: Manually Setup nginx
$ ghost setup nginx ssl: Setup nginx with SSL

Accessing Ghost Admin interface

Your setup is now ready, access Ghost web admin interface where you can upload themes, change settings and write content using markdown syntax.

To complete setup of your publication, visit:

install ghost cms ubuntu 18.04 01

Create your first Ghost administrator/publisher account.

install ghost cms ubuntu 18.04 02
ghost create stories

You have successfully installed Ghost CMS on Debian 11 / Debian 10. Also check other guides on web hosting and documentation.

LEAVE A REPLY

Please enter your comment!
Please enter your name here