RHEL BasedRocky Linux

How To Install Ghost on Rocky Linux 9

Install Ghost on Rocky Linux 9

In this tutorial, we will show you how to install Ghost on Rocky Linux 9. For those of you who didn’t know, Ghost is a popular open-source blogging platform that allows users to easily create and manage their own blogs. It is written in JavaScript and runs on the Node.js library, making it a highly scalable and flexible platform.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Ghost Content Management System on Rocky Linux. 9.


  • A server running one of the following operating systems: Rocky Linux 9.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Ghost on Rocky Linux 9

Step 1. The first step is to update your system to the latest version of the package list. To do so, run the following commands:

sudo dnf check-update
sudo dnf install dnf-utils

Step 2. Installing Nginx Web Server.

By default, Nginx is not available on Rocky Linux 9 base repository. Now run the following command below to add Nginx stable repository to your system:

sudo tee /etc/yum.repos.d/nginx-stable.repo<<EOF
name=nginx stable repo

Now, run the following command to install the latest stable version of Nginx to your server:

sudo dnf update
sudo dnf install nginx

Once the installation is done, start the Nginx service and enable it to automatically start on reboot all in one go with:

sudo systemctl enable --now nginx

To verify that the latest version of Nginx has been installed, run:

nginx -v

By default, Nginx listens on ports 80 and 443. If any firewall is installed and configured on your server, then you will need to allow both ports via firewalld. You can allow them with the following command:

sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

You can verify by listing the current firewall settings:

sudo firewall-cmd --permanent --list-all

In addition, we set up SELinux now allows Nginx to connect to the network:

sudo setsebool -P httpd_can_network_connect 1

For additional resources on installing Nginx, read the post below:

Step 3. Installing Node.js on Rocky Linux 9.

By default, Node.js is not available on Rocky Linux 9 base repository. Now run the following command below to add the NodeSource repository to your system:

curl -sL https://rpm.nodesource.com/setup_16.x | bash -

Next, install the latest Node.js version with the following command:

sudo dnf install nodejs

Verify the installed Node.js version using the command:

node -v

To verify the NPM version, run the following command:

npm -v

For additional resources on installing Node.js, read the post below:

Step 4. Installing MariaDB Database.

By default, MariaDB is available on Rocky Linux 9 base repository. Now run the following command below to install the latest stable version of MariaDB to your system:

sudo dnf install mariadb-server mariadb

Once the installation is complete, start the MariaDB service and enable it to automatically start on boot by running the following command below:

sudo systemctl enable mariadb --now
sudo systemctl start mariadb
sudo systemctl status mariadb

To check the version of MariaDB installed, run the command below:

mariadb --version

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:


Configure it like this:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

You can now try to access the database with the set root user password:

mysql -u root -p

Now create a database user, database, and assign control over the created database to the user:

MariaDB [(none)]> CREATE DATABASE ghostdb;
MariaDB [(none)]> CREATE USER 'ghostuser'@'localhost' IDENTIFIED BY 'your-strong-password';
MariaDB [(none)]> GRANT ALL ON ghostdb.* TO 'ghostuser'@'localhost';
MariaDB [(none)]> EXIT;

For additional resources on installing MariaDB, read the post below:

Step 5. Installing Ghost on Rocky Linux 9.

Run the following command to install the Ghost-CLI tool. Ignore any warnings you receive during the process:

sudo npm install ghost-cli@latest -g

Next, create the Ghost root directory:

sudo mkdir -p /var/www/html/ghost

Set the ownership and directory permissions:

sudo chown $USER:$USER /var/www/html/ghost
sudo chmod 755 /var/www/html/ghost

In your terminal, navigate to the directory and run it using the following command:

cd /var/www/html/ghost
ghost install

During the installation, the CLI tool will ask a number of questions to configure:

  • At the time of writing this tutorial, Ghost-CLI doesn’t support any other OS apart from Ubuntu. It will ask if you still want to continue with the installation. Press Y to continue.
  • Blog URL: Enter your complete blog URL along with the HTTPS protocol. (https://ghost.your-domain.com)
  • MySQL Hostname: Press Enter to use the default value  localhost since our Ghost install and MySQL are on the same server.
  • MySQL Username: Enter root your MySQL username.
  • MySQL Password: Enter your root password created before.
  • Ghost database name: Give a name for your Ghost database. (ghostdb)
  • Sudo password: Enter your system’s sudo password to perform elevated commands.
  • Set up a ghost MySQL user?: The installer will ask if you want to create a separate MySQL user for Ghost. Press Y to proceed.
  • Set up Nginx?: Usually, Ghost-CLI detects your Nginx installation and automatically configures it for your blog. But as of now, it can’t detect our Nginx install. Hence, the installer will automatically skip this step. We will configure Nginx manually.
  • Set up SSL?: Since it skipped over the Nginx configuration, the CLI tool will also skip setting up an SSL.
  • Set up systemd?: Ghost will ask if you want to set up a system service for Ghost. Press Y to proceed.
  • Start Ghost?: Press Y to start your Ghost installation. The service will start but we will need to configure Nginx and SSL to make it work.

Step 6. Installing Certbot.

We generate the SSL Certificate from Let’s Encrypt manually by running the below commands:

sudo dnf install certbot python3-certbot-nginx

Then, run the following command to generate certificates with the Nginx:

sudo certbot --nginx

Step 7. Accessing Ghost Web Interface.

Once successfully installed, open your web browser and access the Ghost admin interface using the URL https://ghost.your-domain.com. You should see the following page:

Install Ghost on Rocky Linux 9

Congratulations! You have successfully installed Ghost. Thanks for using this tutorial for installing Ghost Content Management System on your Rocky Linux 9 system. For additional help or useful information, we recommend you check the official Ghost website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button