Today you will learn how to install Ghost on Ubuntu 22.04
Ghost is an open-source blogging platform which allows you to create a professional looking online blog. Ghost is a solid content management system (CMS) with a easy-to-use interface and comes with beautiful themes. It is based on NodeJS and have many features like Built-In-SEO Control, REST API, Great security and reliable.
Requirements :
- 1-2GB of RAM (The more the better performance and the larger the blog you can host)
- 1-2vCore CPU (The more the cores the better the performance)
- 5-10GB of Disk Space
- Ubuntu 22.04
- Root Access or User with Sudo Access
- FQDN (Optional but recommended) (Fully Qualified Domain Name)
Step 1 : Update your server
First step is to update your server which will look for newer packages and security updates for your distribution :
apt-get update -y
apt-get upgrade -y
Step 2 : Installing Requisites
Now, After updating our server we will move on to installing the main requisites required for Ghost, Run the following command to install it :
Create a user for Ghost and add it to sudoers :
adduser ghost
usermod -aG sudo ghost
apt-get install build-essential
Now, We will install NGINX and MariaDB :
apt-get install nginx mariadb-server
mysql_secure_installation
Copy the steps as shown in the picture or text :
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
Step 3 : Installing NodeJS :
Since Ghost is based on NodeJS and can be installed through npm, We will install it on our server, Run the following command to install :
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash
apt-get install -y nodejs npm
Step 4 : Installing Ghost on Ubuntu :
We have now everything setup to install Ghost , Run the following command to install Ghost :
npm install ghost-cli@latest -g
Create a directory for the website :
su ghost
sudo mkdir -p /var/www/ghost
Give permission to the folder :
sudo chown ghost:ghost /var/www/ghost
sudo chmod 775 /var/www/ghost
cd /var/www/ghost
Run the following command to install Ghost :
ghost install
Copy the steps or do the steps according to yourself :
Enter your blog URL: http://localhost:2368 or (Your domain name)
? Enter your MySQL hostname: localhost
? Enter your MySQL username: ghostuser
? Enter your MySQL password: [hidden] (Password of ghost comes here)
? Enter your Ghost database name: ghost
? Do you wish to set up Systemd? Yes
? Do you want to start Ghost? Yes
You can either access your website at the domain you specified or the http://localhost:2386/ghost/
Conclusion :
You have installed GhostCMS on your Ubuntu 22.04 Machine. This tutorial starts as root and install Ghost as a sudo user.