Page 2: Installing Ghost-CLI and Configuring MariaDB User/Schema

3. Installing Ghost-CLI

Ghost-CLI is the official command-line tool that manages all Ghost operations: installation, configuration, updates, start/stop. It must be installed globally.

# Install Ghost-CLI globally
sudo npm install -g ghost-cli

4. Creating MariaDB Database and User

Create a dedicated database for the Ghost application and a user with access limited only to that database to enhance security. This must be done by logging into MariaDB with root privileges.

4.1. MariaDB Login and Command Execution

# Log in with MariaDB root account (password required)
sudo mysql -u root -p

Once the MariaDB shell is open, execute the following commands in order. (Replace angle brackets with your configurations.)

# 1. Create a dedicated Ghost database (e.g., ghost_db)
CREATE DATABASE <ghost_database_name> CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;

# 2. Create a dedicated MariaDB user for Ghost and set password (e.g., ghost_user)
CREATE USER '<ghost_db_user>'@'localhost' IDENTIFIED BY '<secure_password_for_db_user>';

# 3. Grant all privileges on the database to that user
GRANT ALL PRIVILEGES ON <ghost_database_name>.* TO '<ghost_db_user>'@'localhost';

# 4. Apply privileges and exit MariaDB shell
FLUSH PRIVILEGES;
EXIT;

Important: You must remember or safely store <ghost_database_name>, <ghost_db_user>, and <secure_password_for_db_user> as they will be used during the Ghost installation.