How to Install Ghost on Ubuntu 24.04
Ghost is an open-source blogging platform designed to help users in online publishing. It makes the publishing process simple for publishers, developers, and entrepreneurs. It is built on JavaScript and runs on Node.js, making it a modern and efficient platform for web development. Think of Ghost as a tool that helps you set up and manage a blog or website without doing any complex coding. You can use Ghost as a headless through Ghost CMS, which means you can manage all your content in one place and display it anywhere using APIs. It provides a sleek, elegant, and user-friendly platform for users looking to publish content online with ease and style.
Installing Ghost on Ubuntu 24.04 is simple, and can be done quickly through this guide, here, you will find:
How to Install Ghost on Ubuntu 24.04
To install Ghost on Ubuntu 24.04, follow the below-given steps:
Step 1: Install Nginx Server on Ubuntu
Ghost requires a Nginx server that should be installed on your system. You can install the Nginx server on Ubuntu through the following command:
sudo apt install nginx -y
Step 2: Confirm Nginx is Running
After installing Nginx on Ubuntu, ensure that the server is running on your system, it can be done using the provided command:
sudo systemctl status nginx
Step 3: Configure Firewall for Nginx
To allow traffic on both HTTP (80) and HTTPS (443) ports, you can run the below-given command:
sudo ufw allow 'Nginx Full'
Note: You can install UFW on Ubuntu through the following command:
sudo apt install ufw -y
Then enable the UFW on Ubuntu using the below-given command:
sudo ufw enable
After completing the UFW installation, and allowing the traffic for the Nginx server, you must reload UFW using the following command:
sudo ufw reload
Step 4: Install MySQL Server on Ubuntu
To set up a ghost database, you are required to install MySQL server on Ubuntu using the following command:
sudo apt install mysql-server -y
Step 5: Setup MySQL Database
Now, to create a ghost database, first, enter the MySQL monitor using the below-given command:
sudo mysql
Then create a new user and password for MySQL using the below-given command:
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
Note: Ensure to replace the user and password of your own choice.
After that, create a database with the name ghost using the following command:
CREATE DATABASE ghost;
Then provide your created database all privileges on all tables using the below-mentioned command:
GRANT ALL PRIVILEGES ON database.* TO 'ghost'@'localhost';
Once done, reload the grant table on MySQL database through the following command:
FLUSH PRIVILEGES;
Then exit the MySQL database using the following command:
EXIT
Step 6: Install Node.js and NPM on Ubuntu
You should also install Node.js and NPM on Ubuntu because these two are required for ghost installation on the system. You can install Node.js and NPM directly from the Ubuntu standard repository using the following command:
sudo apt install nodejs npm -y
Note: For installing the latest Node.js version on Ubuntu, you can read here.
Step 7: Install Ghost CLI on Ubuntu
Now, install ghost cli on Ubuntu from npm installer using the below-given command:
sudo npm install -g ghost-cli@latest
To ensure ghost cli is successfully installed on Ubuntu, you can use the following command:
ghost --version
Step 8: Create a Directory for Ghost Files
For ghost installation, it is advised to create a dedicated directory where all installation files of ghost will be stored. You can create a directory to place ghost files on Ubuntu through the following command:
sudo mkdir -p /var/www/ghost
You can change directory ownership to your desired user by using the command provided below:
sudo chown username:username /var/www/ghost
Then set the permission of the created ghost directory on Ubuntu using the following command:
sudo chmod 775 /var/www/ghost
Step 9: Install Ghost CMS on Ubuntu
To install Ghost CMS on Ubuntu, first, navigate to the directory using the cd command with the directory name:
cd /var/www/ghost/
Then install Ghost CMS through the following command:
ghost install
Wait for the installation to proceed, initially, it will check for the Node.js version, folder permission, and other required things:
Once the verification is done, it will ask you to enter details like blog URL, MySQL hostname, username, password, database name, and username password. You can go with the default blog URL, hostname as localhost. While, change the username, password, and database name according to the one you have set up in the earlier steps.
Do it carefully according to your choice, since it will set up Ghost CMS on Ubuntu. You can enter the blog URL on your own using the domain name if you are setting Ghost CMS for production. However, for a beginner, it is a good idea to go with the default one.
The setup may ask for some approvals on whether to set up systemd and start Ghost, reply with Yes to complete the Ghost installation on Ubuntu:
Step 10: Access Ghost Web Interface
Now, open the Firefox browser on your system and enter the address in the browser that appears right after the Ghost installation on Ubuntu:
In my case, the address is given below:
http://localhost:2368/ghost/
Entering the address will open the Ghost Admin page, where you have to provide Site title, full name, email address, and password on your own. After entering the details, click on Create account and start publishing button:
This will open your Ghost website on the browser:
You can now customize your Ghost website, add posts, build your audience, and share your publication.
Note: If you want to uninstall Ghost from the Ubuntu system, simply run the ghost uninstall command inside the ghost source directory. You can also use the ghost update command to update Ghost on Ubuntu.
In case of any issue, use the ghost doctor command to check for any potential hiccups when installing Ghost. If your desired URL is causing an issue while loading, simply remove the source directory, create a new one, and then perform the installation again.
Conclusion
Ghost is a modern blogging platform used for creating and running online blogs and publications. It gives you the power to publish your content easily and beautifully with all the design and functionality. You can install Ghost on Ubuntu 24.04 by first installing the Nginx server on the system. After that, install MySQL server and create a database for the Ghost including the database name, username, and password.
You must also install Node.js and Ghost CLI to set up the Ghost installation on Ubuntu. Once done, create a Ghost directory, give the necessary permission to it, and run the ghost install command to successfully install Ghost on Ubuntu. You can then access the Ghost web interface using the address provided to you after the installation. This address can be then used in the browser to access the Ghost CMS.





















