In this tutorial we are going to learn how to install Ghost CMS on Ubuntu 18.04. We will also install and configure its prerequisites. Ghost is a cross platform professional blogging application. It is powered by a Node.js and modern stacks. It is written in Java-script and managed by the Ghost foundation. It has a clean design that is focus only for bloggers with clean Interface makes it popular in blogging platform. It is a lightweight application and most important thing it is a powerful blogging platform.
I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 18.04 Bionic Beaver minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install Ghost CMS on Ubuntu 18.04
Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:
apt-get update -y apt-get upgrade -y
Step 2. Installing LEMP on Ubuntu 18.04.
You should check out this LEMP stack install tutorial for Ubuntu 18.04, if you haven’t installed LAMP yet. Once it’s installed, come back here and read on.
Step 3. Installing Node.js.
Ghost cms is based on Node.js run the commands below to download Node.js packages from its repository:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
Next, run the commands below to install Node.js:
sudo apt-get install nodejs sudo apt install npm
Step 3. Installing the Ghost CMS on Ubuntu 18.04.
First, create a new user account called ghostuser which will be used to install Ghost:
sudo adduser ghostuser sudo usermod -aG sudo ghostuser
Next, create a new Ghost root directory for its content:
sudo mkdir -p /var/www/html/ghost/
Then, change the directory permissions so the ghostuser owns it:
sudo chown -R ghostuser:ghostuser /var/www/html/ghost sudo chmod -R 755 /var/www/html/ghost
We’ll install Ghost using the official ghost-cli program. This program will install Ghost, create the MySQL user and database, configure Nginx as a reverse proxy, and secure the site using SSL/TLS encryption:
sudo npm i -g ghost-cli ghost install
You’ll be prompted for info about the site URL, database connection information to complete the installation. Answer the questions it prompts with. For more information about questions it prompts visit Ghost docs:
ghostuser@ubuntu1804:/var/www/html/ghost$ ghost install ✔ Checking system Node.js version ✔ Checking logged in user ✔ Checking current folder permissions System checks failed with message: 'Linux version is not Ubuntu 16' Some features of Ghost-CLI may not work without additional configuration. For local installs we recommend using `ghost install local` instead. ? Continue anyway? Yes ℹ Checking operating system compatibility [skipped] ✔ Checking for a MySQL installation ✔ Checking memory availability ✔ Checking for latest Ghost version ✔ Setting up install directory ✔ Downloading and installing Ghost v1.22.2 ✔ Finishing install process ? Enter your blog URL: http://example.com ? Enter your MySQL hostname: localhost ? Enter your MySQL username: ghostuser ? Enter your MySQL password: [hidden] ? Enter your Ghost database name: ghost ✔ Configuring Ghost ✔ Setting up instance Running sudo command: useradd --system --user-group ghost Running sudo command: chown -R ghost:ghost /var/www/html/ghost/content ✔ Setting up "ghost" system user ? Do you wish to set up "ghost" mysql user? No MySQL user is not "root", skipping additional user setup ℹ Setting up "ghost" mysql user [skipped] ? Do you wish to set up Nginx? No ℹ Setting up Nginx [skipped] Task ssl depends on the 'nginx' stage, which was skipped. ℹ Setting up SSL [skipped] ? Do you wish to set up Systemd? Yes ✔ Creating systemd service file at /var/www/html/ghost/system/files/ghost_example-com.service Running sudo command: ln -sf /var/www/html/ghost/system/files/ghost_example-com.service /lib/systemd/system/ghost_example-com.service Running sudo command: systemctl daemon-reload ✔ Setting up Systemd Running sudo command: /var/www/html/ghost/current/node_modules/.bin/knex-migrator-migrate --init --mgpath /var/www/html/ghost/current ✔ Running database migrations ? Do you want to start Ghost? Yes Running sudo command: systemctl is-active ghost_example-com ✔ Ensuring user is not logged in as ghost user ✔ Checking if logged in user is directory owner ✔ Checking current folder permissions Running sudo command: systemctl is-active ghost_example-com ✔ Validating config ✔ Checking folder permissions ✔ Checking file permissions ✔ Checking content folder ownership ✔ Checking memory availability Running sudo command: systemctl start ghost_example-com ✔ Starting Ghost Running sudo command: systemctl is-enabled ghost_example-com Running sudo command: systemctl enable ghost_example-com --quiet ✔ Starting Ghost You can access your blog at http://example.com Ghost uses direct mail by default To set up an alternative email method read our docs at https://docs.ghost.org/docs/mail-config
Step 4. Accessing Ghost CMS Web Installation.
Now you can access the Ghost CMS web install wizard in your browser by entering the domain name or http://ip_address to continue your Ghost installation.
Congratulation’s! You have successfully install and configured Ghost CMS on your Ubuntu 18.04 LTS server. Thanks for using this tutorial for installing Ghost CMS on Ubuntu 18.04 LTS (Bionic Beaver) system.