1. Ghost and Self-Hosting Overview
Ghost is a fast and powerful publishing platform running on a Node.js environment. This guide focuses on the Self-Hosted method, providing high performance and flexibility, utilizing Node.js LTS, MariaDB 8.0+, and Nginx/Apache configurations for stable operation.
2. Installing Required Software and Creating User (Rocky Linux based)
Install the essential software for Ghost and create a dedicated user for enhanced security.
2.1. Installing Node.js (LTS Version)
Ghost requires the latest LTS version of Node.js. We use NodeSource to install a stable version.
# System update and install curl
sudo dnf check-update
sudo dnf install -y curl
# Run Node.js LTS (latest stable version) installation script
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
# Install Node.js
sudo dnf install -y nodejs
2.2. Installing Nginx, Apache, and MariaDB Server
Nginx or Apache is used as the web server/proxy, and MariaDB as the database. Choose one of the web servers based on your preference.
# Install Nginx, Apache (httpd) and MariaDB Server
sudo dnf install -y nginx httpd mariadb-server
# Start MariaDB service and run security configuration (root password, remove anonymous users, etc.)
sudo systemctl start mariadb
sudo mariadb-secure-installation
2.3. Creating Dedicated Ghost User and Permissions
For security reasons, we create a dedicated non-root user to run Ghost.
# Create 'ghost-user'
sudo adduser ghost-user
# Grant sudo access to 'ghost-user' (needed during installation)
sudo usermod -aG wheel ghost-user
# Switch to 'ghost-user' login
sudo su - ghost-user
Note: All subsequent Ghost-related commands must be run while logged in as ghost-user.