Ghost CMS is a fast, secure, open source platform built on Node.js that can be a good alternative to WordPress, Medium, or other blog platforms. While Ghost has built-in SEO support, member payments, and email newsletters, there is no ecommerce support yet so it may not be right for you.
This guide will walk through the steps to install Ghost CMS on a server running Ubuntu 16.04, 18.04 or 20.04.
- Create a sudo user.
- Update the repository and upgrade packages.
- Point your domain to your Hostwinds VPS using Hostwinds DNS Manager, or using an A record at your DNS host.
- Log in via SSH as the non-root sudo user. You will not be able to install Ghost as the root user.
Step 1: Install Nginx
Install Nginx by running:
sudo apt-get install nginx
If ufw firewall is running on the server, allow Nginx through the firewall:
sudo ufw allow 'Nginx Full'
Step 2: Install MySQL
Next, install the MySQL server:
sudo apt-get install mysql-server
At this point, it is recommended to use the secure installation script. Follow the prompts given:
Ubuntu 18.04 and 20.04 only:
Lastly, ensure Ghost-CLI is compatible with MySQL. Set the root password with the following:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
End Ubuntu 18.04 and 20.04 only.
Step 3: Install Node.js
Then you will need to install Node.js with the following:
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash
sudo apt-get install -y nodejs
Step 4: Install Ghost
We will first install Ghost-CLI, a useful tool for managing Ghost on your server:
sudo npm install ghost-cli@latest -g
It is required to install Ghost in a new directory, so we will create one called
sudo mkdir -p /var/www/ghost
Define the directory owner by replacing <user> with your username:
sudo chown <user>:<user> /var/www/ghost
Set the permissions:
sudo chmod 775 /var/www/ghost
Then change to the new directory:
Now start the installation:
Blog URL: Enter your domain that is pointed to the server, including the protocol (https://your-domain-name.com).
MySQL hostname: For this installation, we should use
localhost, as MySQL was installed on this server. If your database is hosted on another server, enter the hostname.
MySQL username: For new installations, use
MySQL password: Enter the
Ghost database name: Create a name for your database.
The remaining options are recommended, and SSL will be installed using Let’s Encrypt.
Now you should be able to reach your Ghost blog at https://your-domain-name.com. Start creating your blog at https://your-domain-name.com/ghost.