/ AWS

Setup Ghost blog under 30 minutes on AWS

Lets setup Ghost blog under 30m on AWS!

So for the last year or so I was constantly thinking of setting up blog but couldn't set up for various reasons. Now that I got time I implemented it so let me help you too. I made this blog so you could setup within 30 minutes. It took me more than that.

So to setup a Ghost blog is not as straightforward as with Wordpress hosting. In the past I have used Wordpress for my earlier blog and starting off as a PHP Developer was helpful in that area. I have worked in Wordpress CMS also.

The reason why I wanted to utilize Ghost is because of the site layout and readability factor it gave out. It's simple and concentrates more on the site main content. Wordpress has evolved more into a major CMS now.

Compared to Wordpress setup which is practically done entirely by multiple Hosting providers Out-Of-the-box, setting up Ghost is more rewarding so if your a developer you will enjoy setting up Ghost and many blogs utilize ghost nowadays so it won't be a bad choice. You can either setup Ghost on your own manually on the server or a slightly faster way as below,

1. Login to AWS EC2 & choose Ghost certified by Bitnami AMI

AWS-Select-Ghost-AMI-1

The amount on this subscription is only for the EC2 charges and no software charges atleast at the time of subscribing, please validate at time of selection.
I selected the t2.micro instance which should be sufficient.

I guess the services this ghost blog setups up are,

  1. apache web server for reverse proxying
  2. mysql db for the data store
  3. ghost blog itself.

Download the new key-pair(eg. blog.pem) which will be needed to login to the terminal of the machine for manual intervention.

2. Ghost blog setup

AWS will provision the EC2 instance with Ghost setup and ready to consume.
If your luck is good! :)
To visit the ghost blog we can visit the IP for the respective Instance.

ec2-server-ip

Please jump straight to step 7 if the ghost blog is up.
If you are greeted with an HTTP server error then we need to manually intervene!
An HTTP error usually means the web server is working and ghost is not.

3. Restart ghost

From your machine terminal login to the EC2 Server,

$ ssh ubuntu@10.10.10.10 -i blog.pem

Ghost application status check

bitnami@user:~$ ghost ls
┌───────────┬────────────────────────────────┬─────────┬─────────┬─────┬──────┬─────────────────┐
│ Name      │ Location                       │ Version │ Status  │ URL │ Port │ Process Manager │
├───────────┼────────────────────────────────┼─────────┼─────────┼─────┼──────┼─────────────────┤
│ 127-0-0-1 │ /opt/bitnami/apps/ghost/htdocs │ 1.24.6  │ stopped │ n/a │ n/a  │ n/a             │
└───────────┴────────────────────────────────┴─────────┴─────────┴─────┴──────┴─────────────────┘
bitnami@user:~$ ls -la /opt/bitnami/apps/ghost/htdocs/

Let us start ghost now.

To start ghost you need to go into the directory where the ghost-cli resides.
If you do not, you will be greeted with the message below,

bitnami@user:/opt/bitnami/apps/ghost/bin$ ghost run
Working directory is not a recognisable Ghost installation.
Please run `ghost run` again within a folder where Ghost was installed with Ghost-CLI.

The path I had,

/opt/bitnami/apps/ghost/htdocs

So after going to the right directory

bitnami@user:/opt/bitnami/apps/ghost/htdocs$ ghost start
ℹ Ensuring user is not logged in as ghost user [skipped]
ℹ Checking if logged in user is directory owner [skipped]
✔ Checking current folder permissions
✔ Validating config
✔ Checking memory availability
✔ Starting Ghost
You can access your publication at http://10.10.10.10:80
Your admin interface is located at http://10.10.10.10/ghost/

Ghost uses direct mail by default
To set up an alternative email method read our docs at https://docs.ghost.org/docs/mail-config

After that you can visit your user address or relevant DNS and you will get the ghost blog running.

bitnami@user:/opt/bitnami/apps/ghost/htdocs$ ghost ls
┌───────────┬────────────────────────────────┬─────────┬──────────────────────┬─────────────────────────┬──────┬─────────────────┐
│ Name      │ Location                       │ Version │ Status               │ URL                     │ Port │ Process Manager │
├───────────┼────────────────────────────────┼─────────┼──────────────────────┼─────────────────────────┼──────┼─────────────────┤
│ 127-0-0-1 │ /opt/bitnami/apps/ghost/htdocs │ 1.24.6  │ running (production) │ http://10.10.10.10:80   │ 2368 │ local           │
└───────────┴────────────────────────────────┴─────────┴──────────────────────┴─────────────────────────┴──────┴─────────────────┘

4. Now you can visit the ghost admin site

The login credentials are present in two places,
1. The AWS dashboard
Right click the respective instance and Instance Settings > Get System Log
aws-ec2-log
2. The system. The credentials details will be present in the bitnami user home directory with the name bitnami_credentials

5. Domain Name for the blog

Now your ghost blog is running. You would probably want the IP address to be sooner or later covered by a DNS. I compared online from various sites for DNS names with respect to getting the best price and nothing could beat the one I got at Fgrade Secure Services.I got a good price of just Rs.450/- including Privacy for Domain.
Updating the DNS is simple and fast. Within the DNS Management page for the respective provider you should update the DNS A record where name will be @ and value will be the IP address of the EC2 Instance. For me after this update within 30s I could see the change i.e. going to http://iphilip.org showed me my ghost blog running.
dns-mgmt-A

6. Update Ghost blog with DNS name

Within the server terminal we need to edit the config present at,
/opt/bitnami/apps/ghost/htdocs
url value to the domain name.
my value was

 {
 ...
 "url": "http://iphilip.org",
 }

Then we need to restart ghost again by executing,

  bitnami@user:/opt/bitnami/apps/ghost/htdocs$ ghost restart
  ✔ Restarting Ghost
  bitnami@user:/opt/bitnami/apps/ghost/htdocs$ ghost ls
          ┌───────────┬────────────────────────────────┬─────────┬──────────────────────┬────────────────────┬──────┬─────────────────┐
  │ Name      │ Location                       │ Version │ Status               │ URL                │ Port │ Process Manager │
  ├───────────┼────────────────────────────────┼─────────┼──────────────────────┼────────────────────┼──────┼─────────────────┤
  │ 127-0-0-1 │ /opt/bitnami/apps/ghost/htdocs │ 1.24.6  │ running (production) │ http://iphilip.org │ 2368 │ local           │
  └───────────┴────────────────────────────────┴─────────┴──────────────────────┴────────────────────┴──────┴─────────────────┘

Blog away with Ghost!

p.s. Last but not the least, to remove the Bitnami banner you can login to server and execute following command,

bitnami@user:/opt/bitnami/apps/ghost$ sudo ./bnconfig --disable_banner 1

Then restart ghost.

Setup Ghost blog under 30 minutes on AWS
Share this