Install Hexo on Ubuntu

Install nvm (Node Version Manager)

1
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash

If that fail, try manual install:

1
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`

Then add these lines to ~/.bashrc, ~/profile, or ~/.zshrc:

1
2
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

At last, reopen your terminal or logout and login again.

Install Node and npm

nvm bundles node with npm (node package manager), so you only need to install node.

1
2
3
4
5
6
7
8
9
nvm install node  # this install the latest version of node

nvm use node # use the latest vesion of node

nvm alias default node # set a default node version to be used on any new shell

nvm ls # list installed node vesions

nvm ls-remote # list what vesions are available to install

Install hexo and init a blog

1
2
3
4
5
npm install hexo-cli -g
hexo init blog
cd blog
npm install
hexo server

Done.

Reference: https://hexo.io/docs/index.html