Ghost Is a beautiful opensource blogging platform, which in my opinion is far better than WordPress, Medium Or Blogger for blogging and Creator economy platform. Being an open source platform you can self-host a ghost blog yourself for free. Ghost also offers managed hosting starting at 9 dollars/month. You can also use DigitalOceans one click Ghost deployment which will cost you 6 dollars/month. (Get free DigitalOcean Credit here).
Today we will learn how to host a Ghost Blog for Free on Oracle Cloud Easily, and to reduce complexity and minimize command line we will be using a free software CloudPanel for our dashboard (here is a demo CloudPanel dashboard). It is almost perfect for a not-so-tech-savvy person.
This site itself runs on a free tier VPS from oracle cloud using CloudPanel. I am using the Casper Theme. I modified the code using CloudPanel user interface.
Oracle Cloud Free Tier Offerings:
Services you can use for an unlimited time (as per oracle)
- Up to 4 instances of ARM Ampere A1 Compute with 3,000 OCPU hours and 18,000 GB hours per month. (so 4 ARM CPU cores, 24 GB total ram)
- Two AMD Compute VMs (1 Core CPU 1 GB RAM Both)
- 200 GB of Block Storage with NVMe SSDs ( so max 4 boot vloumes 50GB each, max 200 GB)
- Data egress to all regions up to 10TB( 10,000 GB) per month.
- You can choose any region as your home region during account setup.
This is an insane amount of always free compute resources out there.
Pros and Cons of CloudPanel
- Very easy to setup CloudPanel on any server ( beautiful guides available from cloudpanel).
- Easy one click SSL installation from Let's Encrypt.
- They support NODE.JS and NGINX and MySQL out of the box so Ghost will be an easy install. You don't need to do any server configuration.
- You can install multiple ghost site on the same server.( by just using a different port)
- Other than a ghost blog you can also install multiple WordPress sites as well as static HTML and PHP , Python sites all in a single server. And it comes handy more often than not.
- Cloud-panel UI is visually very modern and clean. It will come handy later for maintenance and code modifications.
- You will get direct access to the Ghost files in CloudPanel UI. It saves a ton of time in the long run and makes minor theme modifications much much easier.
- You need a server with at least 2 GB ram. It is not a problem with Oracle Cloud's A1 Instances(which we will use). But I can't install it on the free AMD instance for 1GB ram limitation. I have not tried it on google cloud. Although, for updating ghost you will require more than 1 GB ram so, I think we will be good to go with the Oracle A1 Instance.
Here are some screenshots of the CloudPanel UI
Let me show you the UI i am talking about.
See, I am talking about this beauty. You will not get it even in Ghost Pro. Believe me, you will need this UI, more often than you think. It was my only reason to choose CloudPanel.
Steps We will follow In this Procedure:
Steps (Resource added below):
- Create a Oracle Cloud Account
- Create a oracle free tier account
- Remember to give a correct address (Oracle is very strict)
- Upgrade your account to Pay As You Go. Otherwise oracle sometimes pauses free tier resources,when underutilzed. Also you will get better availability for A1 compute instances.(Don't worry you wont be charged unless you go over free tier.)
- Create a VM Instance (remember this steps)
- Use Ubuntu lts minimal with ARM 64
- Use Ampere A1 instace (max 4 core cpu and 24 GB ram)
- Remember to save the SSH key.
- Add IPv4, for best practice add it later (by reserving a static IP)
- Don't Use all the 4 cores and 24 gb ram at once, we don't need that much compute, keep some for other projects (like Uptime Kuma). Also you don't need 200GB boot storage, keep it default 47GB. You can change it later when needed.
- Connect to the VM using SSH, for windows user use PUTTY.
- Follow the official CloudPanel documentation to install cloudpanel
- Install Ghost
- Go to CloudPanel dashboard
- Add site, add a NODEjs site
- Always save the site username, password, and database username and password.
- Install Ghost following the below guideline.
- Update your DNS record
- Install SSL using Let's Encrypt
- Go to yourdomain.com/ghost for Ghost admin
- CloudPanel official Installation Guide for Oracle Cloud
- Here is Nice Video Demonstrating Account setup, CloudPanel Setup and SSL setup on oracle cloud.
If your are using CloudFlare and SSL doesn't work, then turn off the orange cloud and try again.
Finally, you are ready to install Ghost. Don't worry. By going this CloudPanel way you have already done most of the jobs. You don't need to manually install Nginx, node.js, MySQL-server etc. And believe me, configuring those is much harder.
Installing Ghost On CloudPanel:
Hopefully you have installed CloudPanel successfully and can access the CloudPanel dashboard. CloudPanel also has an installation guide about Ghost. But it needs a few more additions and explanations and there is no YouTube video out there. So let me explain the steps here.
Steps (Screen captures added below) :
- Click on Add a Site and create a Nodejs site.
- Write down your domain name or subdomain you want to use.
- App-port should be: 2368 (change it for subsequent ghost installations)
- Put your name as the site user and put a site user password.
- Go to database and create a database, also create a database user with a password.
Note down your site user name and site user password in the notepad or any note-taking app. You will need it always.
Here is some screen captures of how to do it.
Setup SSL: Now Before moving further go to SSL/TLS > Action > New Let'sEncrypt certificate. It will auto install your certificate. And again if you kept orange cloud on at Cloudflare it will cause an error.
After this step, if you are using Cloudflare, go to the cloudflare dns dashboard and turn the precious orange cloud on. Also check that your SSL settings at Cloudflare is set to Full or Strict. Otherwise you will encounter too many redirects error.
Now proceed with your ghost installation.
- Now SSH into your VPS using root ( I love putty on windows )
- Then log in as a site user by typing
sudo su <site user name>
- Install Ghost Cli using the npm command.
npm install ghost-cli@latest -g
- Copy the code in the next box in the notepad and change the values starting with $ (including the $ sign) and replace it with the credentials you saved earlier (don't put $). If you use different app port (for subsequent ghost installs) change the port to that in the below code.
ghost install --db mysql --port 2368 \ --dbhost 127.0.0.1 \ --dbuser $DATABASE_USER_NAME \ --dbpass $DATABASE_USER_PASSWORD \ --dbname $DATABASE_NAME \ --process local \ --no-setup-linux-user \ --no-setup-ssl \ --no-setup-nginx \ --dir /home/$SITE_USER/htdocs/$DOMAIN/
- At the $domain enter the domain like www.example.com, don't enter HTTP...
it should look like this (example)-
ghost install --db mysql --port 2368 \ --dbhost 127.0.0.1 \ --dbuser iamgoat \ --dbpass strongpassword \ --dbname myblogdb \ --process local \ --no-setup-linux-user \ --no-setup-ssl \ --no-setup-nginx \ --dir /home/iamgoat/htdocs/myblog.com/
- In the next step when Ghost installation is complete, it will ask you about your blog URL in that place write it like https://www.example.com.
Now you have a functioning Ghost blog at your domain name. Access the admin panel at www.yourdomain.com/ghost/ and create a user id and password.
Remember that ghost is installed in a folder and you need to access the folder to update, run, stop and troubleshoot the ghost instance. To go there SSH into your VPS. Log in to your site user. and then cd into the folder using
Autorestart ghost after an Instance Reboot ( Not Necessary)
To auto start your ghost instance after a reboot add this cron job. It is not super necessary. Only if you reboot your server just reboot ghost also.
- Log in via SSH as a site user
- Create scripts directory:
3. Create a start script:
4. Modify the --dir value and save the start script:
#!/bin/bash export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm ghost start --dir $HOME/htdocs/ghost.moby.io/ --no-setup-linux-user > $HOME/logs/ghost.log &
5. Set execution permissions:
chmod 700 ~/scripts/ghost-start.sh
6. Edit the crontab for the site user.
7. Replace SITE_USER with your site user and add the following line:
@reboot /home/$SITE_USER/scripts/ghost-start.sh &> /dev/null
8. Now reboot and test if Ghost is running as expected
My own setup runs using this method. Use cloudflare for better speed and performance. You will find many guides online about cloudflare but I will write one later. I have tested this method up to ghost 5.69 release on nodejs version 16. Version 18 does not quite work well for me. To specify the version use this on the above command: (hope fully it will be solved when you use it)
ghost install 5.69 --db mysql --port 2368 \ --dbhost 127.0.0.1 \ --dbuser $DATABASE_USER_NAME \
Note: As you see, it is better if you have some idea about servers in any self-hosted setup. But you will be able to do it. And in the early days of your blog when it does not generate enough revenue it is not a bad idea to self-host. But If your blog becomes cash flow positive you should consider switching to a ghost pro plan. It will give you the peace of mind.
Also if you are planning a newsletter, join ghost pro. Because if you self host you have to pay $35/month for a Mail-gun subscription. Note: I found out later that you can send monthly 1000 email for free using mailgun. But more than that will cost money. You will get that same thing included in ghost pro. So self-hosting will be costly in that case. A server with 4 core CPU and 24 GB of ram will be plenty to support a lot of traffic in the long run, don't worry. The only concern is how long Oracle is going to provide that server for free. But when you have large enough traffic you do not want to play with your server up-time and lose traffic.
Anyways if you are starting a blog, go with this free installation. And start expressing yourself. Ghost is a fantastic platform for blogging. And, for blogging purposes, you should avoid WordPress. Here is why.
I will be learning ghost for the next few days and will be writing a follow-up post about taking this installing to almost professional level. Today It is already long enough. And I will try my best to keep this post updated.
Thanks for reading this far, I hope this was helpful. Consider sharing this post in social medias if you find it helpful.
Newsletter of The SmartGoat Blog
occational posts. No spam. Unsubscribe anytime.