After already writing a blog post on installing ghost on Amazon EC2, found here: Installing Ghost on EC2, I found that there is a much easier way now if your running the Amazon Linux image on EC2. Below, is the directions on how to do this.

Reason for Change

So my free tier on Amazon EC2 has just expired, so this leads me to start finding cheaper ways to host my blog. I have found that Amazon "Reserved Instances" are the best option for hosting a blog, however, this means I need to migrate my blog to a new server.

Install Ghost

Time to download and install ghost on server. This can't get any easier. Just follow these simple commands:

Redirect Ports

perform a redirect on iptables to make everything coming in on http port 80 to go to port 2368 (the port your ghost server is listening on). You can do that with this iptables command: sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 2368

Run Ghost

npm start --production

Test It

Open up your favorite browser and navigate to your IP address:2368. For example, if your Amazon EC2 instance is running on 54.2.4.5 then enter 54.2.4.5:2368 in the address bar in your browser.

Run Ghost in Background

If you want to be able to close your shell and not have your node server shut down you must start your node process in the background. To do this we use the nohup command like so:

nohup npm start --production &

Point your Domain Name to Amazon EC2 Server

Next is to take your registered domain name and have it point to your new ghost blogging server. I have a separate post for just that using Route53 and GoDaddy. That post is found here: GoDaddy and Route53

Conclusion

I found this way a lot easier than downloading and building node from source, plus, this using yum package manager, so we will be able to get updates and patch fixes. Hope this helps.

Case Studies

An Open View

Subscribing to our blog is a great way to stay up to date with the latest information from Vizuri, as well as our strategic partners. We focus on providing a range of content that is practically useful and relevant from both a technical and business perspective.