
本文主要介绍如何在自己的电脑上搭建博客系统,先建立小小的成就感
系列文章:http://t.cn/RSSaUQt
环境准备
安装node.js
官网地址:https://nodejs.org/en/
安装
检测
1 2 3 4 5
| $ node -v v6.10.0
$ npm -v 3.10.10
|
切换镜像源
由于某些原因,直接从官网安装模块比较慢,经常性地安装失败,最好切换到国内的淘宝镜像源来,
1
| $ npm install -g cnpm --registry=https://registry.npm.taobao.org
|
安装hexo
搭建博客的核心框架,通过它就可以让我们在不需要编码的情况下搭建好自己的博客,官网地址:https://hexo.io/
安装
1
| $ sudo npm install hexo-cli -g
|
检测
1 2 3 4 5 6 7 8 9 10 11
| $ hexo -v os: Darwin 16.6.0 darwin x64 http_parser: 2.7.0 node: 6.10.0 v8: 5.1.281.93 uv: 1.9.1 zlib: 1.2.8 ares: 1.10.1-DEV icu: 58.2 modules: 48 openssl: 1.0.2k
|
搭建博客
创建博客目录
1 2 3
| $ hexo init myBlog $ cd myBlog $ npm install
|
生成默认网页
浏览器访问
1 2 3
| $ hexo s
INFO Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.
|
浏览器访问 http://localhost:4000/
如若看到如下效果,恭喜搭建成功!

发表你的第一篇文章
创建博文
1 2
| $ cd myBlog $ hexo new "我的第一篇博文"
|
编辑博文内容
发布
1 2 3
| $ cd myBlog $ hexo clean && hexo g $ hexo s
|
再次访问 http://localhost:4000/
hexo 常用命令学习
详见:http://t.cn/R5x40qE
1 2 3 4
| $ hexo init [folder] $ hexo clean $ hexo g $ hexo s
|