Simple Way Installing Ghost on Debian

This tutorial tested on Debian Squid and Wheezy. You can also using this tutorial on Ubuntu. No more words, just try and do it with your own risk.

1. Compile Node.JS

apt-get update  
apt-get clean  
apt-get install git-core curl build-essential openssl libssl-dev sqlite3 libsqlite3-dev

cd /usr/src; git clone  
cd node; git checkout v0.10.21  
./configure --openssl-libpath=/usr/lib/ssl
make install

node -v  
npm -v  

2. Installing Ghost

mkdir -p /home/aris/ghost  
cd /home/aris/ghost  
wget --no-check-certificate  
unzip ghost-*.zip; rm ghost-*.zip

npm install sqlite3 mysql  
npm install --production  

3. Using Ghost with custom domain

Copy config.example.js to config.js

Open config.js and edit the domain to your own domain.

4. Using Ghost behind nginx

apt-get install nginx

cat > /etc/nginx/sites-available/ospian-ghost <<EOF  
server {  
  listen 80;
  rewrite ^/(.*)$1 permanent;
server {  
  listen 80;
  access_log /home/aris/ghost/akses.log;
  error_log     /home/aris/ghost/error.log;
  location / {
    proxy_pass                    http://localhost:2368/;
    proxy_set_header     Host $host;
    proxy_buffering     off;

ln -s /etc/nginx/sites-available/ospian-ghost /etc/nginx/sites-enabled/ospian-ghost  
service nginx restart  

Create the bash script for starting Ghost /home/aris/ghost/

export NODE_ENV=production  
exec /usr/local/bin/npm start $_GHOST_DIR 2>&1 >> ghost_run.log  

Then set the permission:

chmod +x /home/aris/ghost/  

Run Ghost with execute

cd /home/aris/ghost  

To stop Ghost, firstly get running process

netstat -tunap | grep node  
kill <pid>  

5. Autorun Ghost when server startup using crontab

crontab -e -u aris  

and then add this line:

@reboot /home/aris/ghost/ > /home/aris/ghost/cron.log 2>&1

NB: don't forget to change the path /home/aris/ghost with your Ghost location and domain with your own domain.

Thank you for reading. Enjoy it an d enjoy your Ghost !!!