Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
No Result
View All Result
Home Google Cloud

How to Install Ghost CMS on Ubuntu 18.04 – Google Cloud

by Cloudbooklet
5 years ago
in Google Cloud, Compute Engine
How To Install Ghost Cms On Ubuntu 18.04 - Google Cloud
ShareTweetSendShare
Readers like you help support Cloudbooklet. When you make a purchase using links on our site, we may earn an affiliate commission.

How to Install Ghost CMS on Ubuntu 18.04 with Google Cloud and connect with Cloud SQL for database. Ghost is an open-source powerful blog platform built over Node.js and it’s also fully customizable. This setup is tested on Google Cloud Platform, so this guide can be used on any other cloud hosting services or VPS […]

ADVERTISEMENT

How to Install Ghost CMS on Ubuntu 18.04 with Google Cloud and connect with Cloud SQL for database.

Ghost is an open-source powerful blog platform built over Node.js and it’s also fully customizable.

This setup is tested on Google Cloud Platform, so this guide can be used on any other cloud hosting services or VPS or Dedicated server running Ubuntu.

ADVERTISEMENT

Prerequisites

  1. Your Compute Engine Instance running with minimum 1 GB RAM.
  2. For setting up Compute Engine, see the Setting up Compute Engine Instance.
  3. Domain name is pointed to your virtual machine.
  4. For setting up Cloud DNS, see the Setting up Google Cloud DNS for your domain.
  5. Google Cloud SQL Setup, see Setup Cloud SQL and connect with Compute Engine.

Install Nginx

Ghost uses Nginx web server, you can start updating the packages and install Nginx. SSH to your VM Instance and execute the following commands

You might also like

How To Setup Ssh Keys On Ubuntu

How to Setup SSH Keys on Ubuntu 20.04

4 months ago
Draggan Ai Editing Tool Install And Use Draggan Photo Editor

DragGAN AI Editing Tool Install and Use DragGAN Photo Editor

4 months ago
sudo apt update
sudo apt upgrade

sudo apt install nginx

Once Nginx is installed proceed to configure and enable UFW.

sudo ufw allow OpenSSH
sudo ufw allow 'Nginx HTTP'
sudo ufw allow 'Nginx HTTPS'
sudo ufw enable

Install Node.js

To install Ghost you need a supported Node.js version, so you can use the officially recommended Node.js v10.

ADVERTISEMENT
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt install -y nodejs

Confirm the Node.js and NPM installation with the following commands.

node -v
npm -v

You will get the installed version number.

ADVERTISEMENT

Install Ghost-CLI

You can use the official ghost-cli to setup MySQL user and database and configure Nginx as reverse proxy and finally secure the site with Let’s Encrypt SSL certificate.

sudo npm install ghost-cli@latest -g

Install Ghost

Once your server is setup and ghost-cli is installed you can install Ghost.

ADVERTISEMENT

Note: Installing Ghost in /root or home/ directories results in a broken setup. Use a custom directory with properly configured permissions.

You can use the recommended location to install Ghost which is /var/www/ghost

ADVERTISEMENT
sudo mkdir /var/www/ghost

Set up correct permissions.

sudo chown $USER:$USER /var/www/ghost
sudo chmod 775 /var/www/ghost

Move inside the directory and install Ghost.

cd /var/www/ghost/
ghost install

You will see the output as follows.

Output
✔ Checking system Node.js version
✔ Checking logged in user
✔ Checking current folder permissions
✔ Checking operating system compatibility
Local MySQL install not found. You can ignore this if you are using a remote MySQL host.
Alternatively you could:
a) install MySQL locally
b) run ghost install --db=sqlite3 to use sqlite
c) run ghost install local to get a development install using sqlite3.
? Continue anyway? (y/N)

Type Y and hit Enter

Output
MySQL check skipped
ℹ Checking for a MySQL installation [skipped]
✔ Checking memory availability
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v2.13.1
✔ Finishing install process

Now you will be prompted to enter your blog URL, enter http://yourdomainname.com

MySQL hostname enter Cloud SQL IP Address

MySQL username enter username

MySQL password enter password

Ghost database name enter database name

Output
? Enter your blog URL: http://yourdomainname.com
? Enter your MySQL hostname: CLOUD_SQL_IP_ADDRESS
? Enter your MySQL username: username
? Enter your MySQL password: password
? Enter your Ghost database name: database_name
✔ Configuring Ghost
✔ Setting up instance
sudo useradd --system --user-group ghost
sudo chown -R ghost:ghost /var/www/ghost/content
✔ Setting up "ghost" system user
? Do you wish to set up "ghost" mysql user? Yes

You will be asked to setup ghost user, you need to allow this setup.

Output
MySQL user is not "root", skipping additional user setup
ℹ Setting up "ghost" mysql user [skipped]
? Do you wish to set up Nginx? Yes

Allow Nginx setup.

Output
✔ Creating nginx config file at /var/www/ghost/system/files/yourdomainname.com.conf
sudo ln -sf /var/www/ghost/system/files/yourdomainname.com.conf /etc/nginx/sites-available/yourdomainname.com.com.conf
sudo ln -sf /etc/nginx/sites-available/yourdomainname.com.com.conf /etc/nginx/sites-enabled/yourdomainname.com.conf
sudo nginx -s reload
✔ Setting up Nginx
? Do you wish to set up SSL? Yes

Allow SSL setup and provide your email address to create and install Let’s Encrypt certificate.

Output
? Enter your email (For SSL Certificate) your_email_address
sudo mkdir -p /etc/letsencrypt
sudo ./acme.sh --install --home /etc/letsencrypt
sudo /etc/letsencrypt/acme.sh --issue --home /etc/letsencrypt --domain yourdomainname.com.com --webroot /var/www/ghost/system/nginx-root --reloadcmd "nginx -s reload" --accountemail your_email_address
sudo openssl dhparam -out /etc/nginx/snippets/dhparam.pem 2048
sudo mv /tmp/ssl-params.conf /etc/nginx/snippets/ssl-params.conf
✔ Creating ssl config file at /var/www/ghost/system/files/yourdomainname.com-ssl.conf
sudo ln -sf /var/www/ghost/system/files/yourdomainname.com-ssl.conf /etc/nginx/sites-available/yourdomainname.com-ssl.conf
sudo ln -sf /etc/nginx/sites-available/yourdomainname.com-ssl.conf /etc/nginx/sites-enabled/yourdomainname.com-ssl.conf
sudo nginx -s reload
✔ Setting up SSL
? Do you wish to set up Systemd? (Y/n)

You will be prompted to set up a systemd service. Press Y to continue.

Output
✔ Creating systemd service file at /var/www/ghost/system/files/ghost_yourdomainame-com.service
sudo ln -sf /var/www/ghost/system/files/ghost_yourdomainname-com.service /lib/systemd/system/ghost_yourdomainname-com.service
sudo systemctl daemon-reload
✔ Setting up Systemd
? Do you want to start Ghost? (Y/n)

Now press Y to start Ghost.

Ghost is installed successfully and you can access the admin interface by http://yourdomainname.com/ghost

You will be greeted with the Ghost Welcome page.

41B11Edc Ghost Welcome Page

Click Create your account.

824Acf24 Ghost Create Account

Fill all the details and complete the setup and visit the dashboard.

Ca5Aba4B Ghost Dashboard

That’s all, Great! In this tutorial, you installed Ghost, configured Nginx to proxy requests to Ghost, and ensured that Ghost runs as a system service.

Tags: Compute EngineGhostGoogle Cloud Platform
ShareTweetSendShare
Cloudbooklet

Cloudbooklet

Comments 6

  1. Avatar Of Joseph Joseph says:
    4 years ago

    Thank you for the detailed instructions. I was able to publish the Ghost site/theme at my domain (homeimproov.com) but the “WWW” version gives me a “not secure” message.

    I tried following your other Lets Encrypt instructions but ran into problems and had to re-install the Ghost theme
    https://www.cloudbooklet.com/secure-nginx-with-lets-encrypt-ubuntu-18-04-google-cloud
    ** I tried this again and go the following error (pasted below). It still behaves the same (homeimproov.com “ok” but “WWW” version not working)

    Any suggestions would be greatly appreciated.

    joseph@meta-media1:/etc/nginx/sites-available$ sudo nginx -t
    nginx: [warn] conflicting server name “homeimproov.com” on 0.0.0.0:443, ignored
    nginx: [warn] conflicting server name “homeimproov.com” on 0.0.0.0:443, ignored
    nginx: [warn] conflicting server name “homeimproov.com” on [::]:443, ignored
    nginx: [warn] conflicting server name “homeimproov.com” on [::]:443, ignored
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful

    Reply
    • Avatar Of Cloudbooklet Cloudbooklet says:
      4 years ago

      Thank you for using Cloudbooklet, To install SSL you can try Ghost cli commands. https://ghost.org/docs/api/v3/ghost-cli/setup/

      Reply
      • Avatar Of Joseph Joseph says:
        4 years ago

        It was an issue with Let’s Encrypt that I was able to solve. If anyone else is having problems the Let’s Encrypt community is a great place for support.
        https://community.letsencrypt.org/

        Reply
  2. Avatar Of Joseph Joseph says:
    4 years ago

    Thank you for the detailed instructions. I was able to publish the Ghost site/theme at my domain (homeimproov.com) but the “WWW” version gives me a “not secure” message.

    I tried following your other Lets Encrypt instructions but ran into problems and had to re-install the Ghost theme
    https://www.cloudbooklet.com/secure-nginx-with-lets-encrypt-ubuntu-18-04-google-cloud/

    Any suggestions would be greatly appreciated.

    Reply
  3. Avatar Of Alex Alex says:
    5 years ago

    Hello.

    One of the best tutorials for Ghost on Compute Engine so far.

    However, I’m having trouble. The error is “Error trying to connect to the database”.

    I’ve a Google Cloud MySQL Instance running and I’ve tried specifying SQL hostname as ‘localhost’ as well as ‘public IP of the instance’. Neither worked.

    Please help.

    Reply
    • Avatar Of Cloudbooklet CloudBooklet says:
      5 years ago

      Thanks for your interest Alex. I am happy to help you solve the problem. Please check and ensure the following steps are done.

      1. In APIs and Services make sure the Cloud SQL API is enabled.

      2. In your, Compute Engine Instance make sure you chose to “Allow full access to all Cloud SQL APIs” in Identity and API access

      3. In your Cloud SQL instance under Connections tab add the IP address of the Compute Engine Instance in Authorized networks and save.

      4. Use Public IP address of Cloud SQL as the hostname.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related Posts

Set Up Deep Learning With Nvidia, Cuda, Cudnn On Ubuntu

How to Set Up Deep Learning with Nvidia, CUDA, cuDNN on Ubuntu 22.04

7 months ago
How To Install Or Upgrade Php 8.2 On Ubuntu 22.04

How to Install or Upgrade PHP 8.2 on Ubuntu 22.04

9 months ago
How To Change Timezone On Ubuntu 22.04

How to Change Timezone on Ubuntu 22.04

1 year ago
How To Install Ansible On Ubuntu 22.04

How to Install Ansible on Ubuntu 22.04

1 year ago

Follow Us

Trending Articles

Best Laptop For Minecraft-

5 Best Laptop for Minecraft in 2023: Top Picks for All Budgets

September 21, 2023

10 Best AI Song Generator in 2023 (Free and Paid)

Amazon Prime Big Deal Days 2023: Best Deals

5 Free AI Soulmate Maker: Create Your Perfect Match

How to Block YouTube Ads on Android TV in 2023 (6 Easy Methods)

AI Statistics and Trends: What You Need to Know in 2023

Popular Articles

Best 8 Instagram Profile Downloader For 2023

Best 8 Instagram Profile Downloader for 2023

August 30, 2023

How to Use Canva on ChatGPT: A Step-by-Step Guide

HeyGen AI: Free AI Video Generator to Create Amazing Videos

Top 9 NSFW AI Story Writers to Try Today

Best 10 AI Comic Generator: Create Comic book in Seconds

10 Best Free AI Porn Generators in 2023

Subscribe Now

loader

Subscribe to our mailing list to receives daily updates!

Email Address*

Name

Cloudbooklet Logo

Welcome to our technology blog, where we explore the latest advancements in the field of artificial intelligence (AI) and how they are revolutionizing cloud computing. In this blog, we dive into the powerful capabilities of cloud platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure, and how they are accelerating the adoption and deployment of AI solutions across various industries. Join us on this exciting journey as we explore the endless possibilities of AI and cloud computing.

  • About
  • Contact
  • Disclaimer
  • Privacy Policy

Cloudbooklet © 2023 All rights reserved.

No Result
View All Result
  • News
  • Artificial Intelligence
  • Applications
  • Linux

Cloudbooklet © 2023 All rights reserved.