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
Hexo Start

Hexo Start

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment