Learn the commands to install Ghost CMS on Ubuntu 22.04 LTS Jammy JellyFish using the command terminal for hosting your blog.
Ghost is an open-source content management system that has evolved from a pure blog system to a professional publishing software with a built-in subscription and membership portal. Ghost’s technology stack was new and sensational at the time of its creation: With Node.js as the server-side language, Ember.js for the admin interface, and handlebars.js as a template language; Ghost relies entirely on JavaScript, while the storage of data with MySQL database follows comparatively traditional patterns. Meanwhile, server-side JavaScript is widely used in the developer scene, but even today it is still true that most mainstream hosters do not offer node.js in their standard offers.
Furthermore, we can easily install Ghost locally for testing all we have to do is install Node.js and the package manager NPM, which is already integrated into Node. The CLI (Command Line Interface) of Ghost can then be downloaded from the console with a short npm command.
Apart from the subscription method, the users can self-host the Ghost just like WordPress on their cloud or hosting server, all it has to full fill the requirement of this CMS which are:
• A non-root user with sudo rights
• MySQL Database
• NodeJs
• Server with 1GB of free Memory
• Nginx
Steps to install Ghost CMS on Ubuntu 22.04 Linux Server
The steps given here can be used for other versions of Ubuntu such as 18.04/20.04 including Debian.
1. Fully update Ubuntu 22.04
Let’s first run the system update and upgrade command to ensure our desktop or server is up to date. Performing this step will also rebuild the APT package index cache.
sudo apt update && sudo apt upgrade
2. Install Nginx
Ghost needs Nginx for reverse proxy and SSL configuration, hence install it using the:
sudo apt install nginx
3. Install MySQL 8
We can either use MySQL Database Server on Ubuntu 22.04 to store the data generated by the ProcessWire CMS. Here we are using MariaDB Server.
sudo apt install mysql-server
Enable, Start and check service status:
sudo systemctl enable --now mysql
Check:
systemctl status mysql
Ctrl+C to exit.
Login to MySQL first:
sudo mysql
Set root password:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'MyPassword@123';
Note: Change MyPassword@123 with the strong password, you want to set.
Exit:
exit;
Secure your Database Installation:
To secure our Database instance, run the given command and follow the wizard:
sudo mysql_secure_installation
The script will ask these questions.
Enter the password for user root: type your set password and then press ENTER.
Change the password for root? Press N, then ENTER.
Remove anonymous users? Press Y, then ENTER.
Disallow root login remotely? Press Y, then ENTER.
Remove the test database and access to it? Press Y, then ENTER.
Reload privilege tables now? Press Y, then ENTER.
4. Create a Database for Ghost CMS
Login to your Database server by using the password you have set for the root user of it.
sudo mysql -u root -p
Follow the command to create a new DB. However, don’t forget to replace the new_user with whatever name you want to give to your Database user and in the same way- new_db with a name for the Database and your_password for the password.
CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'your_password';
CREATE DATABASE new_db;
GRANT ALL PRIVILEGES ON new_db.* TO 'new_user'@'localhost';
FLUSH PRIVILEGES;
Exit;
6. Install Nodejs on Ubuntu 22.04
The supported versions of NodeJS while doing this article were 14. x and 16. x, here we are installing the LTS 16. x.
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
7. Install Ghost CLI on Ubuntu 22.04
Now, we already have Nodejs and its package manager NPM that we can use to easily install the Ghost CMS on our Ubuntu 22.04 LTS server.
sudo npm install ghost-cli@latest -g
8. Create a directory for Ghost files
To install the Ghost, we will create a dedicated directory that holds all the files and scripts needed by this CMS platform to run.
sudo mkdir -p /var/www/ghost/
After that set the ownership of the created directory to the dedicated user we have created for Ghost.
sudo chown -R $USER:$USER /var/www/ghost/
Set reading and writing rights
sudo chmod 775 /var/www/ghost
9. Install Ghost CMS using its CLI tool
Now, first, switch to the user-created for the Ghost and use that to install this CMS on your system.
Switch to the directory created for Ghost:
cd /var/www/ghost
Run Ghost CMS installation command:
ghost install
The above command will ask you a couple of questions:
Enter your blog URL: your blog url
Enter your MySQL hostname: localhost
Enter your MySQL username: new_user
Enter your MySQL password: [hidden]
Enter your Ghost database name: new_db
Do you wish to set up Nginx? Yes
Do you wish to set up Systemd? Yes
Do you want to start Ghost? (Y/n) Y
Once the installation is completed, you will have the URL to access the Ghost Interface.
10. Create an Admin user
As you access the Ghost CMS, the setup wizard will appear and set your Site Title and other information it asking for. After that move forward to have the front end and admin panel of your blog.


Other Articles:
• How to Install WordPress on Ubuntu 22.04 LTS Server
• Steps to install ProcessWire CMS on Ubuntu 22.04 LTS Linux
• How to install Backdrop CMS on Ubuntu 22.04 Jammy
• How to Install Craft CMS on Ubuntu 20.04 LTS Focal Fossa
Great tutorial, however Ghost no longer works with MariaDb and requires MySQL8.
One of the very few tutorials that actually worked for me… thank you!