Tuesday 22 September 2015

How to Install Ghost on A Low End VPS

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:
  1. How to install Node.js on Ubuntu (Git clone method)
  2. How to install Node.js on CentOS (Git clone method)
  3. 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.
2014-01-22_205454
Step 2 – Double check your Node.js and npm installation by issuing these command syntax:
1
2
node -v
npm -v
pic:
2014-01-22_210125
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:
1
mkdir -p /var/www/
Step 4 – Then go to that folder:
1
cd /var/www
pic:
2014-01-22_210727
Step 5 – next, download Ghost main package, the latest one of course, using this command:
1
curl -L https://ghost.org/zip/ghost-latest.zip -o ghost.zip
pic:
2014-01-22_211047
Step 6 – Now you’ve downloaded ghost.zip file so obviously you have to extract that package first. The command is simple:
1
unzip -uo ghost.zip -d ghost
pic:
2014-01-22_211327
Step 7 – Once done, all the scripts will be extracted at “ghost” folder.
1
cd ghost
pic:
2014-01-22_211615
Step 8 – Finally, issue the magic command to install Ghost on your server:
1
npm install --production
pic:
2014-01-23_114740
the process should complete in about two minutes or more. And once done, you’ll see something like this:
install ghost
Step 9 – Now you can start Ghost to run on your server using following command:
1
npm start
pic:
2014-01-23_115338
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.
2014-01-23_115831
Step 11 – Now edit config.js file. You can use either vi or nano but I really prefer nano.
1
nano config.js
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:
1
yum install nano -y
2014-01-23_120314
Step 12 – Now in Nano editor, scroll down (or use Control+V) and look for some lines under:
1
// ### Production
You’ll find some likes you need to edit (1, 2 and 3):
2014-01-23_121146
  1. Change given default url with your own blog’s url / domain
  2. Replace 127.0.0.1 with your own server’s IP address
  3. Replace port 2368 with 80.
example:
2014-01-23_121631
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:
1
npm start --production
pic:
start ghost
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.
2014-01-23_131911
Common error:
Q: I got error message saying “npm ERR! weird error 8” when starting Ghost.
node error start
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:
1
2
3
4
5
## 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.
2014-01-23_132036
Or you can also see it on your VPS control panel (e.g: SolusVM):
2014-01-23_132441
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.

No comments:

Post a Comment