WordPress is still number one in terms of numbers of installation but in term of popularity, there is another blogging script / CMS recently shows up and being the best popular alternative to WordPress. Meet Ghost, a powerful free blogging script based on –not php but– Node.js. Its tag line is pretty simple: “Ghost – Just a blogging platform“. It is a beautifully designed, completely customizable and completely Open Source blogging platform exists only with one purpose, publishing. Unlike WordPress that has been evolved being a base platform of many types of websites (News site, download directory, membership site, and even online store), with Ghost someone can simply focusing his / her mind just to blogging.
The story behinds its development is pretty interesting, go check it out here.
Enough about what it is and lets go to the tutorial which can be done either on Ubuntu or CentOS, even on a low end VPS. I did the steps below on an awesome low end 128MB SSD VPS from RamNode.
Steps To Install Ghost
Step 0 – The very important thing before you follow all the steps to install Ghost, you have to firstly install Node.js, a modern platform for building fast, scalable and efficient web applications. Don’t worry because the process is not as painful as you never imagine. And luckily, I wrote some tutorials about how to get it done happily:
- How to install Node.js on Ubuntu (Git clone method)
- How to install Node.js on CentOS (Git clone method)
- How to install latest public version (or any version you want) of Node.js on Ubuntu or CentOS (mini ebook).
Step 1 – Once installed, now log back in your VPS. In this tutorial I logged in as root but you can login using any user with root / sudo privilege.
Step 2 – Double check your Node.js and npm installation by issuing these command syntax:
Step 3 – Now make a directory where you’ll put your Ghost files at. In this case I simply put it at /var/www, a common web directory on Linux:
mkdir -p /var/www/
Step 4 – Then go to that folder:
Step 5 – next, download Ghost main package, the latest one of course, using this command:
curl -L https://ghost.org/zip/ghost-latest.zip -o ghost.zip
Step 6 – Now you’ve downloaded ghost.zip file so obviously you have to extract that package first. The command is simple:
unzip -uo ghost.zip -d ghost
Step 7 – Once done, all the scripts will be extracted at “ghost” folder.
Step 8 – Finally, issue the magic command to install Ghost on your server:
npm install --production
the process should complete in about two minutes or more. And once done, you’ll see something like this:
Step 9 – Now you can start Ghost to run on your server using following command:
Now Ghost is running but wait,.. as you can see that Ghost is running with its default configuration and the blog’s url is configured as my-ghost-blog.com. Hence you’ll need to alter some lines of its configuration.
Step 10 – First, shutdown Ghost for a moment by hitting Control+C on your keyboard.
Step 11 – Now edit config.js file. You can use either vi or nano but I really prefer nano.
p.s: If you also want to use nano editor but you get error message saying “command not found“, then simply you need to install nano:
yum install nano -y
Step 12 – Now in Nano editor, scroll down (or use Control+V) and look for some lines under:
// ### Production
You’ll find some likes you need to edit (1, 2 and 3):
- Change given default url with your own blog’s url / domain
- Replace 127.0.0.1 with your own server’s IP address
- Replace port 2368 with 80.
Done? Save the changes. In nano you can do that by hitting Control+O then Enter on your keyboard. Next, exit the editor, in nano use Control+X to exit.
Step 13 – Now you can start Ghost again using previous mentioned command:
npm start --production
That’s it. I have some topics about Ghost for the next upcoming tutorials like how to pointing domain to Ghost server and how to use Nginx or Varnish Cache with Ghost. Make sure to stay tuned with me and don’t forget to follow my twitter @servermomdotcom.
What’s next? Point your domain to your VPS and test it on your browser. Don’t know how? Wait for the upcoming tutorials.
Q: I got error message saying “npm ERR! weird error 8” when starting Ghost.
A: That’s probably you have a webserver running on the same port as Ghost. Mostlikely it is Apache. You can stop it using this command:
## on centos
service httpd stop
## on ubuntu
service apache2 stop
Once stopped, try running Ghost again 🙂
Q: How much RAM does Node.js and Ghost consume?
A: There is no exact amount but I believe it is very very low. My Ghost installation consumes only 86mb. You can check that using free -m command.
Or you can also see it on your VPS control panel (e.g: SolusVM):
SolusVM even detects usage RAM only 13.31 MB or 128 MB and 3.71 MB on vSWAP. So that’s why Ghost plays nice with most of low end vps.