How to Install Ghost on Ubuntu 24.04

Ghost is a modern, open-source, and easy-to-use content management system designed for bloggers, content creators, and publishers to build websites. Ghost focuses more on simplicity, speed, and a friendly user experience than other blogging platforms. Ghost is built on JavaScript and needs Node.js help to run on the system. You won’t require any prior coding experience to work with Ghost. Instead, it offers a user-friendly editor that makes publishing easy, seamless, and enjoyable. The good thing about Ghost is that you can easily create and publish your content from your browser using the Ghost CMS. It lets us manage all our content securely and efficiently in one place.

Ghost is a lightweight platform and when paired with the Ubuntu 24.04 system, it becomes a reliable platform for users to publish/manage their content.

Read this tutorial to get a detailed overview of:

How to Install Ghost on Ubuntu 24.04

Before installing Ghost on Ubuntu 24.04, make sure you have enough space available for the prerequisites to be downloaded on your system. After that, you can perform the below-given steps to install Ghost on your Ubuntu server:

Step 1: Installing NGINX Server on Ubuntu

To set up Ghost on Ubuntu, you are required to install the NGINX web server on your system. The reason is that NGINX is a reverse proxy and can significantly improve the Ghost’s performance and security.

A stable version of the NGINX web server can be installed on Ubuntu by executing the following command:

Installing NGINX Server on Ubuntu

After successfully installing NGINX, use the systemctl command given below to check the server’s status and ensure it is actively running:

Installing NGINX Server on Ubuntu

Step 2: Setting Up Firewall on Ubuntu

To secure the NGINX server and protect it from unauthorized access, you can install Firewall on Ubuntu using the command provided below:

Installing NGINX Server on Ubuntu

Before applying the Firewall rule, make sure the Firewall is enabled on your system, it can be done using the command provided below:

Installing NGINX Server on Ubuntu

Once completing the Firewall installation and enabling it, implement the Firewall rule to allow NGINX traffic using the below-given command:

The command will open port 80 (HTTP) and 443 (HTTPS) for NGINX server on Ubuntu:

Installing NGINX Server on Ubuntu

After you have added a new Firewall rule, it’s now time to update the changes by reloading the Firewall using the following command:

Installing NGINX Server on Ubuntu

Step 3: Installing MySQL on Ubuntu

For creating a Ghost database, first, you need to install a database like MySQL server on Ubuntu. To do this, you can run the below command from the terminal:

Installing MySQL on Ubuntu

You must also note that the MariaDB server won’t work here for Ghost because it is officially not supported yet.

Optional: It is also a good approach to secure your MySQL installation and implement some rules based on your choice. It includes setting a strong password, removing root accounts accessible from outside hosts, and more. You can perform MySQL secure installation by running the below-given command:

Installing MySQL on Ubuntu

You can then pick the options you like to secure your MySQL installation on Ubuntu:

Installing MySQL on Ubuntu

Step 4: Creating a Ghost Database on Ubuntu

Once you set up MySQL, it’s time to create a Ghost database on Ubuntu. For this purpose, first enter the MySQL monitor by executing the mysql command with sudo privileges, as follows:

Installing MySQL on Ubuntu

After this, execute the CREATE USER command to create a new user for your Ghost database and set up a strong password according to your preferences:

Installing MySQL on Ubuntu

After that, create a Ghost database by setting the database name according to your choice using the following syntax:

Installing MySQL on Ubuntu

Once done, grant all privileges to the database you created with your desired username using the following syntax:

Installing MySQL on Ubuntu

Then reload the database changes using the following command:

Installing MySQL on Ubuntu

Finally, close the MySQL setup using the below-given command:

Installing MySQL on Ubuntu

At this phase, we have successfully set up a MySQL database for Ghost on Ubuntu.

Step 5: Installing Node.js and NPM on Ubuntu

The easiest and official way to install Ghost on Ubuntu is through the Node Package Manager (NPM). However, for that, you must install Node.js and NPM as prerequisites from the Ubuntu repository for installing Ghost CLI on the system:

Installing MySQL on Ubuntu

Step 6: Installing Ghost CLI on Ubuntu

Once you have completed the Node.js and NPM installation, you can install Ghost CLI on Ubuntu from the following command:

Installing MySQL on Ubuntu

Then confirm the Ghost CLI installation on Ubuntu using the below-given version command:

Installing MySQL on Ubuntu

Note: The Ghost CLI will help users interact with the Ghost through the command line and perform installation, configuration, and management tasks.

Step 7: Configuring Ghost Directories and Files

To smoothly perform the Ghost installation on Ubuntu and put all the required files in one place, create a separate directory in the location /var/www/. You can name this directory as a ghost and can be created using the mkdir command provided below:

Configuring Ghost Directories and Files

Once you created the directory, you can change its ownership to a user of your choice from the following command:

Configuring Ghost Directories and Files

Then change the read, write, and execute permission to the Ghost directory for the owner and group using the below-given command:

Configuring Ghost Directories and Files

Step 8: Installing Ghost CMS on Ubuntu

After you have done all the handwork, let’s install one final important tool on Ubuntu called Ghost CMS, a powerful content management system. Ghost CMS will help you create and publish content and provide you with an easy-to-use web interface.

To install Ghost CMS, first move toward the Ghost directory in the /var/www/ location using the following command:

Configuring Ghost Directories and Files

After that, install Ghost CMS on Ubuntu through the below-given command:

Configuring Ghost Directories and Files

The process will initially check whether the required prerequisites are installed on the system. It then downloads and installs Ghost’s latest version and finalizes the installation, which might take a few minutes:

Configuring Ghost Directories and Files

Before finalizing the installation, you must enter some information according to your choice. This information includes:

  • Blog URL
  • MySQL hostname
  • MySQL username
  • MySQL password
  • Ghost database name

You have to provide this information according to the settings you have previously done in the database step. For blog URL and hostname, you can choose the default option by simply pressing the Enter button on those options:

Configuring Ghost Directories and Files
Configuring Ghost Directories and Files

Note: Don’t use the IP address in the blog URL because it will not work here, instead you can use a domain name, such as https://example.com.

Another thing you have to do is to reply with Yes to set up Systemd and start Ghost on the system:

Configuring Ghost Directories and Files
Configuring Ghost Directories and Files

Once the process starts Ghost on your system, you will be provided with a URL for accessing the Ghost web interface:

Configuring Ghost Directories and Files

Copy the URL, open your web browser on the Ubuntu server, and enter it in the address bar to open the Ghost admin page:

Configuring Ghost Directories and Files

Enter your site title, full name, email, and a strong password for Ghost admin, then click on the Create account & start publishing button:

Configuring Ghost Directories and Files

If everything is done according to the above-mentioned steps, you will be able to open the Ghost admin web interface on the browser:

Configuring Ghost Directories and Files

At this point, you are now ready to create your website using different customization options, add posts, view sites, and perform other website-related tasks.

Configuring Ghost Directories and Files

Conclusion

Ghost is a robust and streamlined platform for authors, bloggers, publishers, and businesses. It allows every individual to create their content without any coding experience. To install Ghost on Ubuntu 24.04, first install NGINX from the Ubuntu repository, then install the MySQL server, secure it, and create a database for Ghost on Ubuntu. After this, install Node.js and NPM so that you will be able to install Ghost CLI on the system from the NPM command.

You must also ensure creating a separate Ghost directory, and set appropriate permission for the directory to allow the user to read, write, and execute it. Then install Ghost CMS using the ghost install command and add the required information to get the URL address to access Ghost Admin on the browser. At that point, you can begin using Ghost on the browser and start creating your content and publishing it online.

Scroll to Top