Running Hexo on Hostgator

I have been searching for a static site generator for a while and there are lots of great ones out there but none of them were a good fit for me. Then I found Hexo.

Its small, fast, has templates and archives, supports markdown. It’s awesome. One downside .. it requires node.js. In my case I’m on shared hosting so I can’t shouldn’t run node as a server because they probably won’t be too happy about that.

But there should be no problem just using it as a CLI static site generator and not running long server processes. The only thing I need to do to make things run smoothly is to turn off multi-threading and thankfully there’s a setting for that.

So here’s the steps I did to get this all setup.

Note: Do this at your own risk.

Lets get started. If you try to run node you’ll get this error in response.

-jailshell: node: command not found

You’ll need to install the binary manually. Currently the latest node version is v0.10.24. The URL for the latest that you’ll need is on node’s website http://nodejs.org/download/ under Linux Binaries (.tar.gz) 32bit.

After you ssh into your account download and extract node

1
2
3
4
5
wget http://nodejs.org/dist/v0.10.24/node-v0.10.24-linux-x86.tar.gz
tar -zxvf node-v0.10.24-linux-x86.tar.gz
rm node-v0.10.24-linux-x86.tar.gz
mv node-v0.10.24-linux-x86 node
cd node

Running ./bin/node -v should show the correct version number v0.10.24.

Next you need to edit your bash profile and add the correct paths to the node bin directory.

1
nano .bash_profile

Note: Your .bash_profile may be different, The important lines are between the comments.

1
2
3
4
5
6
7
8
9
PATH=$PATH:$HOME/bin

# NODE.js
#--------------------------
PATH=./node_modules/.bin:$PATH
PATH=$HOME/node/bin:$PATH
#--------------------------

export PATH

After saving that file reload the profile

1
source .bash_profile

and try running node -v it should show the version number again. Now we can install Hexo.

1
2
3
npm install hexo -g
npm update hexo -g
hexo version

Next you need to edit the _config.yml file to turn off multi-threading.

1
multi_thread: false

Then you should be good to go. From here you can follow the Hexo Docs to get things started.