Introduction
Ghost is a fully open-source, hackable platform for building and running a modern online publication. It is lightweight and fully customizable with many themes available. The Ghost user interface is simple and intuitive, making it suitable for both beginners and advanced users.
This tutorial will guide you through the installation of Ghost on Ubuntu.
Requirements
This tutorial uses Ubuntu 16.04, but you can use any Ubuntu or Debian version supported by your VPS provider.
In VPS Sell, installing the Ubuntu 16.04 template is quick and easy:
- Log in to the Client Area.
- Select the "My Services > VPS" tab at the top of the menu.
- Click the "Manage" button in the service table.
- Press the "Install OS" button.
- Choose the Ubuntu 16.04 operating system, agree to the warning, and click "Continue."
- Wait 5-10 minutes, then refresh the VPS management page.
Step 1: Updating the System
Update and upgrade your server:
apt-get update
apt-get upgrade -y
Step 2: Create a New User
Create a new user (choose a username different from "ghost"):
adduser <user>
Add the new user to the sudo group:
usermod -aG sudo <user>
Switch to the new user:
su <user>
Step 3: Install Node.js
There are several good methods to install Node.js on your server, so feel free to use whichever you prefer. However, if you don’t have a preferred method and want a simple, hassle-free installation, you can run the following commands:
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
Note: If you encounter the error "-bash: curl: command not found," install curl:
apt-get install curl
Step 4: Install Nginx
Stop Apache if it's installed:
/etc/init.d/apache2 stop
Install Nginx:
sudo apt-get install nginx -y
Step 5: Install MySQL
Install MySQL:
sudo apt-get install mysql-server -y
Set a password for the MySQL root user during the installation process.
Step 6: Install Ghost-CLI
Install Ghost-CLI for an easier Ghost installation:
sudo npm install ghost-cli@latest -g
Step 7: Install Ghost
Create a webroot directory (replace <user>
with your username):
sudo mkdir -p /var/www/ghost
sudo chown <user>:<user> /var/www/ghost
sudo chmod 775 /var/www/ghost
Install Ghost:
cd /var/www/ghost
ghost install
During the installation, provide the following information:
- Blog URL: Enter your website address (not the IP address).
- MySQL hostname: Enter "localhost."
- MySQL user: Enter "root."
- MySQL password: Enter the password you set during MySQL installation.
- Ghost database name: Choose any name (default:
ghost_prod
).
- Set up MySQL Ghost user?: Yes.
- Set up Nginx?: Yes.
- Set up SSL?: Yes.
- Set up systemd?: Yes.
- Start Ghost?: Yes.
Conclusion
Ghost is now installed, configured, and ready to use on your server. Visit yourdomain.tld/ghost
to set up your login credentials and start blogging!