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:
- 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:
node -v npm -v
pic:
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:
cd /var/www
pic:
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
pic:
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
pic:
Step 7 – Once done, all the scripts will be extracted at “ghost” folder.
cd ghost
pic:
Step 8 – Finally, issue the magic command to install Ghost on your server:
npm install --production
pic:
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:
npm start
pic:
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.
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:
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.
example:
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
pic:
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.
Common error:
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.
sudo npm start –production
[sudo] password for administrator:
> ghost@0.5.7 start /var/www/ghost
> node index
Migrations: Up to date at version 003
ERROR: (Code: EADDRNOTAVAIL)
There was an error starting your server.
Please use the error code above to search for a solution.
Hello!
After editing settings.js and trying to start Ghost I get these errors. How to fix that?
npm ERR! ghost@0.5.7 start: `node index`
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the ghost@0.5.7 start script.
npm ERR! This is most likely a problem with the ghost package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node index
npm ERR! You can get their info via:
npm ERR! npm owner ls ghost
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.13.0-32-generic
npm ERR! command “/usr/local/bin/node” “/usr/local/bin/npm” “start” “–production”
npm ERR! cwd /var/www/ghost
npm ERR! node -v v0.10.30
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /var/www/ghost/npm-debug.log
npm ERR! not ok code 0
could you please make a tutorial or explain here how to host multiple ghost on a single VPS. That would be great.
love you tutorials. keep up good work.
thanks a lot.
Hi sawiyati, your blog is super great. i want you know if you have a solution to add ghost to verstacp. I try to do it but i got conflict about port 80 i changed to port 81 but ghost don’t display. If you have any idea, i ‘ll appreciate. Best Regard
ok, i solved by myself, i just made a .htaccess with redirection 301 and everything work fine