How I set up my blog site

How I set up my blog site

This post record the steps I set up this blog site.

Catalog

Env preparation

Installation

Use following command to confirm:

1
2
3
$ node -v
$ npm -v
$ git --version

Github

Connection

Create and copy SSH key:

1
2
3
$ ssh-keygen -t rsa -C "GitHub email"
$ cd ~/.ssh
$ vim id_rsa.pub

Copy the contents

Go to Github -> Settings and Add SSH key

Confirm the connection:

1
$ ssh -T git@github.com

Setup Github Pages repository

Create Username.github.io(your URL)

Install Hexo

1
$ npm install -g hexo-cli

Setup a local workspace:

1
2
3
$ git init
$ hexo init
$ npm install

launch local server:

1
2
3
$ hexo cl
$ hexo g
$ hexo s

or use following command to specify port:

1
$ hexo server -p 5000

visit http://localhost:4000

Deploy to Github server

Install hexo-developer-git:

1
$ npm install hexo-deployer-git --save

edit _config file’s Deployment part:

1
2
3
4
deploy:
type: git
repository: git@github.com:Chen-Yulin/Chen-Yulin.github.io.git
branch: master

then run in bash:

1
$ hexo d