Today we will show you how to install Ghost CMS on Ubuntu 20.04 which is one of the best positioned rivals of WordPress. Let’s go for it.
Ghost is a NodeJS-based CMS for creating blog oriented websites. While this means that it doesn’t have all the features of WordPress, it does make it very fast and simple to use. This makes it ideal for projects where we expect a lot of traffic or personal blogs.
Being based on NodeJS means that we have to install it on a server along with nginx for access. For data management, we have MariaDB. So, we are talking about very popular and well-known programs.
Let’s go for it.
Install NodeJS on Ubuntu 20.04
As the CMS depends on NodeJS,, we have to install it. For this, I have chosen version
16.x but it must work with other not so old versions.
To achieve this, first add the NodeJS 16 repository.
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash
Thereafter, install NodeJS using the command
sudo apt install nodejs
Note: Ghost has many problems with NVM. So, do not install NodeJS using NVM. If you have it installed, I recommend you uninstall it.
To make sure NVM is not installed, you can run
rm -rf $NVM_DIR ~/.npm ~/.bower unset NVM_DIR;
Install Nginx and MariaDB on Ubuntu 20.04
Now we need to install Nginx and MariaDB. To achieve this, run this command.
sudo apt install nginx mariadb-server
This way we can continue.
Prepare MariaDB for Ghost CMS
Before we start, we need to configure MariaDB a bit. First, let’s use the
mysql_secure_installation script to set the root key.
When you run this command, you will be asked for a password. It is currently empty, so enter it by pressing ENTER. Next, you will be asked a few questions
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
Y to all and then the script will finish executing.
It is time to create the database and the user dedicated to Ghost in MariaDB.
Go to the MariaDB console
sudo mysql -u root -p
Create the database, the user with his password and exit the console.
create database blog; grant all on blog.* to user@localhost IDENTIFIED BY "pass"; flush privileges; exit;
You can replace the values with your own. Especially the password.
Install Ghost on Ubuntu 20.04
Before we start the installation, we should create a new system user, which can be any name you like. I will use
sudo adduser blogger
Then, you have to make this user belong to the
sudo usermod -aG sudo blogger
Thereafter, you can start installing Ghost-cli. For this, we will use
npm to make it easier.
sudo npm i -g ghost-cli
This will start the whole process of downloading and installing the dependencies for Ghost-cli which is a utility with which we can install Ghost.
To check the changes, you can run
Love open source? We're hiring Node.js Engineers to work on Ghost full-time. https://careers.ghost.org/product-engineer-node-js Ghost-CLI version: 1.18.2
Now create a folder for Ghost and access it
sudo mkdir -p /var/www/ghost cd /var/www/ghost
Then make the folder belong to the user
sudo chown blogger:blogger /var/www/ghost sudo chmod 775 /var/www/ghost
Next, change the session for the user
sudo su - blogger
Create the new blog folder and access it. Name it whatever you want.
mkdir -p /var/www/ghost/blog.imaginelinux.com cd blog.imaginelinux.com
And from there perform the installation of Ghost.
This will start the entire download process. During the execution, you will be asked for some configurations like the URL that has to be one of your domain, the credentials of the database that we have created, as well as the username and password.
You will also be asked about the Nginx settings, and the service to manage your blog.
At the end you will see a screen like this.
Ghost was installed successfully! To complete setup of your publication, visit: https://blog.imaginelinux.com/ghost/
To check the status of the service controlling your blog, you can run something similar to this
sudo systemctl status ghost_blog-imaginelinux-com.service
Access our newly created blog with Ghost on Ubuntu 20.04
Now you have to open a web browser and log in with the address
https://your-domain/ghost and you will be able to create the admin user.
Then you will see the control panel, and you will be able to use it.
Ghost is positioned as a very interesting CMS that stands out for its speed and also for having many tools that allow us to create blogs quickly in a very professional way.
I hope it has helped you and that you share the post to reach more people.