Yanjie's Blog

这个博客已通过认证

Hexo-Ubuntu-GithubPages 搭建独立博客

📅 | 🏷️ , , ,
文章目录

Ubuntu 安装 node.js

$ wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh
$ source ~/.nvm/nvm.sh
# node.js当前版本号为4.4.3
$ nvm install 4.4.3
$ node -v

Ubuntu 安装和配置 Git

$ sudo apt-get install git
$ sudo apt-get install git-core
$ ssh-keygen -C 'yourgithub@email.address' -t rsa
$ git config --global user.name "your real name"
$ git config --global user.email you@email.address
$ cd ~/.ssh
$ ls

会显示 “idrsa idras.pub“ 两个文件,前一个是私钥,后一个是公钥。将公钥粘贴到你的github账号中的 SSH Public Keys 处即可。

安装并执行 Hexo

npm install -g hexo-cli
$ mkdir Blogs
$ cd Blogs
$ hexo init
$ npm install
~/Blogs $ hexo generate
~/Blogs $ hexo server
# /home/lyj/Blogs/目录下
$ hexo new firstblog
$ cd source/_posts
$ ll
# /home/lyj/Blogs/ 目录下
$ hexo generate
$ hexo server
$ npm install hexo-deployer-git --save
# /home/lyj/Blogs/ 目录下
$ hexo clean
$ hexo generate
$ hexo deploy

大功告成!

参考文档