如何拥有个人的Github技术博客

0?wx_fmt=png

题图:87testing.com


前不久用wordpress搭建了一个博客,用起来感觉不是太好用,并且数据库经常会发生异常挂掉,没找到解决方案。


看到有不少人使用的hexo+github方式搭建属于自己的博客,

于是,我也做了一些尝试,将搭建的过程整理出来,希望也能帮到他人。


同时,推荐没有Blog的朋友也尝试自己搭建下,中间可能会遇到一些问题,解决问题的过程很痛苦,但是只要爱折腾,最终都能迎刃而解。


一、环境准备


1、安装git (https://git-scm.com/downloads) 安装目的:用来把本地的hexo内容push到github上。

2、安装node(https://nodejs.org/en/download/)安装目的:用来生成静态页面

3、申请github账号(https://github.com/) ssh keys相关的配置之前介绍过,这里就不过多描述:http://www.87testing.com/2017/07/02/pycharm-e5-85-b3-e8-81-94github/



二、安装hexo


1、创建一个文件夹blog,进入到这个blog目录,安装hexo,执行:sudo npm install -g hexo


如下代表执行成功:

TTZhangdeMacBook-Pro:blog admin$ sudo npm install -g hexo

Password:

npm WARN deprecated swig@1.4.2: This package is no longer maintained

/usr/local/bin/hexo -> /usr/local/lib/node_modules/hexo/bin/hexo


> dtrace-provider@0.8.5 install /usr/local/lib/node_modules/hexo/node_modules/dtrace-provider

> node scripts/install.js



> fsevents@1.1.2 install /usr/local/lib/node_modules/hexo/node_modules/fsevents

> node install


[fsevents] Success: "/usr/local/lib/node_modules/hexo/node_modules/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node" already installed

Pass --update-binary to reinstall or --build-from-source to recompile


> hexo-util@0.6.1 postinstall /usr/local/lib/node_modules/hexo/node_modules/hexo-util

> npm run build:highlight



> hexo-util@0.6.1 build:highlight /usr/local/lib/node_modules/hexo/node_modules/hexo-util

> node scripts/build_highlight_alias.js > highlight_alias.json


/usr/local/lib

└─┬ hexo@3.3.8 

  ├── abbrev@1.1.0 

  ├── archy@1.0.0 

  ├── bluebird@3.5.0 

  ├─┬ chalk@1.1.3 

  │ ├── ansi-styles@2.2.1 

  │ ├── escape-string-regexp@1.0.5 

  │ ├─┬ has-ansi@2.0.0 

  │ │ └── ansi-regex@2.1.1 

  │ ├── strip-ansi@3.0.1 

  │ └── supports-color@2.0.0 

  ├─┬ cheerio@0.20.0 

  │ ├─┬ css-select@1.2.0 

  │ │ ├── boolbase@1.0.0 

  │ │ ├── css-what@2.1.0 

  │ │ ├── domutils@1.5.1 

  │ │ └── nth-check@1.0.1 

  │ ├─┬ dom-serializer@0.1.0 

  │ │ └── domelementtype@1.1.3 

  │ ├── entities@1.1.1 

  │ ├─┬ htmlparser2@3.8.3 

  │ │ ├── domelementtype@1.3.0 

  │ │ ├── domhandler@2.3.0 

  │ │ ├── entities@1.0.0 

  │ │ └─┬ readable-stream@1.1.14 

  │ │   ├── core-util-is@1.0.2 

  │ │   ├── isarray@0.0.1 

  │ │   └── string_decoder@0.10.31 

  │ └─┬ jsdom@7.2.2 

  │   ├── abab@1.0.3 

  │   ├── acorn@2.7.0 

  │   ├── acorn-globals@1.0.9 

  │   ├── cssom@0.3.2 

  │   ├── cssstyle@0.2.37 

  │   ├─┬ escodegen@1.8.1 

  │   │ ├── esprima@2.7.3 

  │   │ ├── estraverse@1.9.3 

  │   │ ├── esutils@2.0.2 

  │   │ ├─┬ optionator@0.8.2 

  │   │ │ ├── deep-is@0.1.3 

  │   │ │ ├── fast-levenshtein@2.0.6 

  │   │ │ ├── levn@0.3.0 

  │   │ │ ├── prelude-ls@1.1.2 

  │   │ │ ├── type-check@0.3.2 

  │   │ │ └── wordwrap@1.0.0 

  │   │ └── source-map@0.2.0 

  │   ├── nwmatcher@1.4.1 

  │   ├── parse5@1.5.1 

  │   ├─┬ request@2.81.0 

  │   │ ├── aws-sign2@0.6.0 

  │   │ ├── aws4@1.6.0 

  │   │ ├── caseless@0.12.0 

  │   │ ├─┬ combined-stream@1.0.5 

  │   │ │ └── delayed-stream@1.0.0 

  │   │ ├── extend@3.0.1 

  │   │ ├── forever-agent@0.6.1 

  │   │ ├─┬ form-data@2.1.4 

  │   │ │ └── asynckit@0.4.0 

  │   │ ├─┬ har-validator@4.2.1 

  │   │ │ ├─┬ ajv@4.11.8 

  │   │ │ │ ├── co@4.6.0 

  │   │ │ │ └─┬ json-stable-stringify@1.0.1 

  │   │ │ │   └── jsonify@0.0.0 

  │   │ │ └── har-schema@1.0.5 

  │   │ ├─┬ hawk@3.1.3 

  │   │ │ ├── boom@2.10.1 

  │   │ │ ├── cryptiles@2.0.5 

  │   │ │ ├── hoek@2.16.3 

  │   │ │ └── sntp@1.0.9 

  │   │ ├─┬ http-signature@1.1.1 

  │   │ │ ├── assert-plus@0.2.0 

  │   │ │ ├─┬ jsprim@1.4.1 

  │   │ │ │ ├── assert-plus@1.0.0 

  │   │ │ │ ├── extsprintf@1.3.0 

  │   │ │ │ ├── json-schema@0.2.3 

  │   │ │ │ └─┬ verror@1.10.0 

  │  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值