How to Install Ghost on AlmaLinux, Rocky Linux, Debian, and Ubuntu

Ghost is a modern, open-source platform for building websites and blogs. This tutorial will guide you through installing Ghost on AlmaLinux, Rocky Linux, Debian, and Ubuntu.


Prerequisites:

Before starting the installation, ensure the following:

  • A server running AlmaLinux, Rocky Linux, Debian, or Ubuntu.
  • Root or sudo access to your server.
  • Node.js and NPM installed (Ghost requires Node.js).
  • A LAMP stack or NGINX (depending on your choice of web server).
  • A domain or subdomain pointing to your server.

Step 1: Update the System

Start by updating your system to ensure all packages are up-to-date.

  • On Ubuntu/Debian:
 
sudo apt update && sudo apt upgrade -y
  • On AlmaLinux/Rocky Linux:
 
sudo dnf update -y

Step 2: Install Required Software

  1. Install Node.js and NPM (Required for Ghost)
  • For Ubuntu/Debian:
 
sudo apt install -y curl curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - sudo apt install -y nodejs
  • For AlmaLinux/Rocky Linux:
 
curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash - sudo dnf install -y nodejs
  1. Install NGINX (or Apache) for web server (optional if you already have one installed).
  • For Ubuntu/Debian:
 
sudo apt install -y nginx
  • For AlmaLinux/Rocky Linux:
 
sudo dnf install -y nginx

Step 3: Install Ghost

  1. Install Ghost-CLI, a command-line tool for managing Ghost:
 
sudo npm install -g ghost-cli
  1. Create a directory for Ghost and navigate to it:
 
mkdir -p /var/www/ghost cd /var/www/ghost
  1. Install Ghost using the Ghost-CLI tool:
 
ghost install

This command will install Ghost, configure NGINX (or Apache), and set up a systemd service for Ghost to run in the background.


Step 4: Configure NGINX (Optional)

If you are using NGINX, you’ll need to configure it for Ghost.

  1. Create an NGINX configuration file:
 
sudo nano /etc/nginx/sites-available/ghost
  1. Add the following content to the file:
nginx
 
server { listen 80; server_name yourdomain.com; location / { proxy_pass http://127.0.0.1:2368; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } }
  1. Enable the NGINX site and restart the service:
 
sudo ln -s /etc/nginx/sites-available/ghost /etc/nginx/sites-enabled/ sudo systemctl restart nginx

Step 5: Set Up Ghost for Autostart

Ghost should start automatically on boot. To enable this, use the following command:

 
ghost start

This will ensure that Ghost runs as a service.


Step 6: Complete the Web Installation

  1. Open your browser and visit your domain (e.g., http://yourdomain.com).

  2. Follow the on-screen instructions to set up your Ghost admin user, database, and website details.


Step 7: Secure Your Site with SSL (Optional)

To secure your Ghost site with SSL, you can use Let’s Encrypt.

  1. Install Certbot:
  • For Ubuntu/Debian:
 
sudo apt install certbot python3-certbot-nginx
  • For AlmaLinux/Rocky Linux:
 
sudo dnf install certbot python3-certbot-nginx
  1. Obtain an SSL certificate for your domain:
 
sudo certbot --nginx -d yourdomain.com

Conclusion

You have successfully installed Ghost on your AlmaLinux, Rocky Linux, Debian, or Ubuntu server. You can now log in to the Ghost admin panel at http://yourdomain.com/ghost to start creating content.

Was this answer helpful? 0 Users Found This Useful (0 Votes)

Powered by WHMCompleteSolution