github上刚用hexo搭好博客,然后就发现GitHub.io被墙了,悲剧
2017-06-14 22:09
375 查看
前两天刚刚在github上用hexo搭好博客,还没开始写文章,就哗啦啦的遇到了GitHub.io被伟大的祖国墙了~~~
我这运气也是够可以的
好吧,把最新的搭建过程贴在这里吧,权当备份了
%% 要点如下
curl -sL https://deb.nodesource.com/setup_8.x | sed "s/exec_cmd \('apt-get update'\)/exec_cmd_nobail \1/g" | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
sudo chown -R $USER:$(id -gn $USER) ~/.config
sudo chown -R $USER /usr/lib/node_modules
cnpm install -g hexo-cli
cd ~
git clone git@github.com:yourname/yourname.github.io.git
cd yourname.github.io.git
cnpm install hexo-deployer-git --save
git config --global user.email "yourname@gmail.com"
git config --global user.name "yourname"
cnpm install hexo-renderer-jade@0.3.0 --save
cnpm install hexo-renderer-sass --save
hexo clean
hexo d -g
%% 以下是详细的过程
## 安装nodejs
https://github.com/creationix/nvm
wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh
nvm install stable
https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
> 由于 apt-get update 失败,上述命令执行失败,改用下述方式:
1、wget https://deb.nodesource.com/setup_8.x
2、注释掉其中的 exec_cmd 'apt-get update'
3、sudo bash setup_8.x
ld@SPEEDOOPS-LAPTO:~$ apt-cache show nodejs |grep -i version
Version: 8.1.0-1nodesource1~trusty1
Version: 0.10.25~dfsg2-2ubuntu1
sudo apt-get install -y nodejs
ld@SPEEDOOPS-LAPTO:~$ sudo apt-get install nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.5 MB of archives.
After this operation, 64.3 MB of additional disk space will be used.
Fetched 12.5 MB in 10s (1,227 kB/s)
Selecting previously unselected package nodejs.
(Reading database ... 24973 files and directories currently installed.)
Preparing to unpack .../nodejs_8.1.0-1nodesource1~trusty1_amd64.deb ...
Unpacking nodejs (8.1.0-1nodesource1~trusty1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up nodejs (8.1.0-1nodesource1~trusty1) ...
ld@SPEEDOOPS-LAPTO:~$ nodejs --version
v8.1.0
测试nodejs
ld@SPEEDOOPS-LAPTO:~$ nodejs hello-node.js
服务器运行在 http://127.0.0.1:3000/
ld@SPEEDOOPS-LAPTO:~$ cat hello-node.js
# https://www.nodebeginner.org/index-zh-cn.html#a-full-blown-web-application-with-nodejs
const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
});
server.listen(port, hostname, () => {
console.log(`服务器运行在 http://${hostname}:${port}/`); });
## github创建工程:blog
https://pages.github.com/
Head over to GitHub and create a new repository named username.github.io, where username is your username (or organization name) on
GitHub.
git clone https://github.com/username/username.github.io
cd username.github.io
echo "Hello World" > index.html
git add --all
git commit -m "Initial commit"
git push -u origin master
Fire up a browser and go to http://username.github.io.
## SSH Key
https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
ssh-keygen -t rsa -b 4096 -C "peter.liude@gmail.com"
生成ssh key,密码navi@123
https://github.com/settings/keys
在个人设置中新建SSH Key,贴入 cat ~/.ssh/id_rsa.pub 的内容
添加完成后再次执行git clone就可以成功克隆github上的代码库了。
## 安装hexo
https://github.com/patrick330602/Hexo-Installer-For-WSL
# https://hexo.io/docs/index.html
npm uninstall -g hexo-cli
npm install -g hexo-cli
npm list hexo
npm list -g
request to https://registry.npmjs.org/npm failed, reason: connect EAGAIN
# http://blog.csdn.net/shelly1072/article/details/51524029
sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
# https://segmentfault.com/a/1190000007391287
cnpm install -g hexo-cli
npm update check failed
sudo chown -R $USER:$(id -gn $USER) /home/ld/.config
Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/hexo-cli_tmp'
sudo chown -R $USER /usr/lib/node_modules
cnpm install -g hexo-cli
sudo ln -s /usr/lib/node_modules/hexo-cli/bin/hexo /usr/bin/hexo
hexo -v
##
hexo init blog
cd blog
npm install
hexo generate
hexo server
更换主题
#https://www.haomwei.com/technology/maupassant-hexo.html
git
clone https://github.com/tufu9441/maupassant-hexo.git themes/maupassant
cnpm install hexo-renderer-jade@0.3.0 --save
cnpm install hexo-renderer-sass --save
编辑Hexo目录下的
* 部署
deploy:
type: git
repository: https://github.com/speedoops/speedoops.github.io.git branch: master
npm install hexo-deployer-git --save
git config --global user.email "peter.liude@gmail.com"
git config --global user.name "Speedoops"
$ hexo deploy
hexo clean && hexo g && hexo d
hexo version
#查看Hexo的版本
hexo d -g
http://www.cnblogs.com/xinxiandong/p/3867505.html
GitHub博客hexo建站之设置SSH 密钥(keys)
Enter passphrase for key '/home/qingxu/.ssh/id_dsa':
仍然需要你输入私钥。而且以后不管你登陆几次,都会提醒你输入私钥,没有达到我们的要求,怎么办呢?
ssh-agent是用于管理密钥,ssh-add用于将密钥加入到ssh-agent中,SSH可以和ssh-agent通信获取密钥,这样就不需要用户手工输入密码了。
不过由于每次登录都需要设置一次,所以最好将命令放到~/.bash_profile中。
另外,可以采用keychain来处理这一步,参考:
http://www.ibm.com/developerworks/cn/linux/security/openssh/part1/index.html
http://www.ibm.com/developerworks/cn/linux/security/openssh/part2/
Markdown编辑器
https://www.zybuluo.com/mdeditor
如何在Hexo博客上使用畅言评论插件?
http://www.zhuoyousheng.cn/hexo-changyan/
http://codepub.cn/2017/03/23/Transfer-comments-from-duoshuo-to-disqus/
多说宣称要进行业务转型,自然评论系统也要关闭,国内的目前比较好的评论系统只有畅言不错,但是畅言需要备案,而我不愿意备案,无奈只能选Disqus了,所以将本站点的多说评论转成Disqus了。
选择Hexo还是Jekyll
于是开始接触比较流行的一些静态博客框架,比较流行的有Jekyll,Hexo,Simple,Octopress,Pelican以及Lo·gecho等等。这些静态程序可以说都有各自的好处,但最后我选择了Hexo来搭建自己的博客,和Jekyll相比,选择Hexo主要原因是:
Jeky基于Ruby实现,安装Jeky需要搭建Ruby环境,在Windows搭建Ruby环境并不是被推荐的,而 Hexo基于NodeJs实现,在Windows上安装NodeJs开发环境简单。
Jekyll没有本地服务器,无法实现本地博文预览功能,需要上传到WEB容器中才能预览功能,而Hexo可以通过简单的命令实现本地的预览,并直接发布到WEB容器中实现同步。
比较直接的另一个原因是在网上查找了很多博客的主题,发现Jekyll官网提供的主题都不怎么好看(可能是个人原因),而Hexo的主题看的比较顺眼。
两者都支持Markdown语法,这点我非常喜欢。
我这运气也是够可以的
好吧,把最新的搭建过程贴在这里吧,权当备份了
%% 要点如下
curl -sL https://deb.nodesource.com/setup_8.x | sed "s/exec_cmd \('apt-get update'\)/exec_cmd_nobail \1/g" | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
sudo chown -R $USER:$(id -gn $USER) ~/.config
sudo chown -R $USER /usr/lib/node_modules
cnpm install -g hexo-cli
cd ~
git clone git@github.com:yourname/yourname.github.io.git
cd yourname.github.io.git
cnpm install hexo-deployer-git --save
git config --global user.email "yourname@gmail.com"
git config --global user.name "yourname"
cnpm install hexo-renderer-jade@0.3.0 --save
cnpm install hexo-renderer-sass --save
hexo clean
hexo d -g
%% 以下是详细的过程
## 安装nodejs
https://github.com/creationix/nvm
wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh
nvm install stable
https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
> 由于 apt-get update 失败,上述命令执行失败,改用下述方式:
1、wget https://deb.nodesource.com/setup_8.x
2、注释掉其中的 exec_cmd 'apt-get update'
3、sudo bash setup_8.x
ld@SPEEDOOPS-LAPTO:~$ apt-cache show nodejs |grep -i version
Version: 8.1.0-1nodesource1~trusty1
Version: 0.10.25~dfsg2-2ubuntu1
sudo apt-get install -y nodejs
ld@SPEEDOOPS-LAPTO:~$ sudo apt-get install nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.5 MB of archives.
After this operation, 64.3 MB of additional disk space will be used.
Fetched 12.5 MB in 10s (1,227 kB/s)
Selecting previously unselected package nodejs.
(Reading database ... 24973 files and directories currently installed.)
Preparing to unpack .../nodejs_8.1.0-1nodesource1~trusty1_amd64.deb ...
Unpacking nodejs (8.1.0-1nodesource1~trusty1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up nodejs (8.1.0-1nodesource1~trusty1) ...
ld@SPEEDOOPS-LAPTO:~$ nodejs --version
v8.1.0
测试nodejs
ld@SPEEDOOPS-LAPTO:~$ nodejs hello-node.js
服务器运行在 http://127.0.0.1:3000/
ld@SPEEDOOPS-LAPTO:~$ cat hello-node.js
# https://www.nodebeginner.org/index-zh-cn.html#a-full-blown-web-application-with-nodejs
const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
});
server.listen(port, hostname, () => {
console.log(`服务器运行在 http://${hostname}:${port}/`); });
## github创建工程:blog
https://pages.github.com/
Head over to GitHub and create a new repository named username.github.io, where username is your username (or organization name) on
GitHub.
git clone https://github.com/username/username.github.io
cd username.github.io
echo "Hello World" > index.html
git add --all
git commit -m "Initial commit"
git push -u origin master
Fire up a browser and go to http://username.github.io.
## SSH Key
https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
ssh-keygen -t rsa -b 4096 -C "peter.liude@gmail.com"
生成ssh key,密码navi@123
https://github.com/settings/keys
在个人设置中新建SSH Key,贴入 cat ~/.ssh/id_rsa.pub 的内容
添加完成后再次执行git clone就可以成功克隆github上的代码库了。
## 安装hexo
https://github.com/patrick330602/Hexo-Installer-For-WSL
# https://hexo.io/docs/index.html
npm uninstall -g hexo-cli
npm install -g hexo-cli
npm list hexo
npm list -g
request to https://registry.npmjs.org/npm failed, reason: connect EAGAIN
# http://blog.csdn.net/shelly1072/article/details/51524029
sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
# https://segmentfault.com/a/1190000007391287
cnpm install -g hexo-cli
npm update check failed
sudo chown -R $USER:$(id -gn $USER) /home/ld/.config
Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/hexo-cli_tmp'
sudo chown -R $USER /usr/lib/node_modules
cnpm install -g hexo-cli
sudo ln -s /usr/lib/node_modules/hexo-cli/bin/hexo /usr/bin/hexo
hexo -v
##
hexo init blog
cd blog
npm install
hexo generate
hexo server
更换主题
#https://www.haomwei.com/technology/maupassant-hexo.html
git
clone https://github.com/tufu9441/maupassant-hexo.git themes/maupassant
cnpm install hexo-renderer-jade@0.3.0 --save
cnpm install hexo-renderer-sass --save
编辑Hexo目录下的
_config.yml,将
theme的值改为
maupassant。
* 部署
vim _config.yml,翻到最下面,改成我这样子的
deploy:
type: git
repository: https://github.com/speedoops/speedoops.github.io.git branch: master
npm install hexo-deployer-git --save
git config --global user.email "peter.liude@gmail.com"
git config --global user.name "Speedoops"
$ hexo deploy
hexo clean && hexo g && hexo d
hexo new "postName" #新建文章 hexo new page "pageName" #新建页面 hexo generate #生成静态页面至public目录 hexo server #开启预览访问端口(默认端口4000,'ctrl + c'关闭server) hexo deploy #将.deploy目录部署到GitHub hexo help # 查看帮助
hexo version
#查看Hexo的版本
hexo g==
hexo generate
hexo d==
hexo deploy
hexo s==
hexo server
hexo n==
hexo new
hexo d -g
http://www.cnblogs.com/xinxiandong/p/3867505.html
GitHub博客hexo建站之设置SSH 密钥(keys)
Enter passphrase for key '/home/qingxu/.ssh/id_dsa':
仍然需要你输入私钥。而且以后不管你登陆几次,都会提醒你输入私钥,没有达到我们的要求,怎么办呢?
ssh-agent是用于管理密钥,ssh-add用于将密钥加入到ssh-agent中,SSH可以和ssh-agent通信获取密钥,这样就不需要用户手工输入密码了。
eval `ssh-agent` ssh-add Enter passphrase for /home/qingxu/.ssh/id_dsa:
不过由于每次登录都需要设置一次,所以最好将命令放到~/.bash_profile中。
另外,可以采用keychain来处理这一步,参考:
http://www.ibm.com/developerworks/cn/linux/security/openssh/part1/index.html
http://www.ibm.com/developerworks/cn/linux/security/openssh/part2/
Markdown编辑器
https://www.zybuluo.com/mdeditor
如何在Hexo博客上使用畅言评论插件?
http://www.zhuoyousheng.cn/hexo-changyan/
http://codepub.cn/2017/03/23/Transfer-comments-from-duoshuo-to-disqus/
多说宣称要进行业务转型,自然评论系统也要关闭,国内的目前比较好的评论系统只有畅言不错,但是畅言需要备案,而我不愿意备案,无奈只能选Disqus了,所以将本站点的多说评论转成Disqus了。
选择Hexo还是Jekyll
于是开始接触比较流行的一些静态博客框架,比较流行的有Jekyll,Hexo,Simple,Octopress,Pelican以及Lo·gecho等等。这些静态程序可以说都有各自的好处,但最后我选择了Hexo来搭建自己的博客,和Jekyll相比,选择Hexo主要原因是:
Jeky基于Ruby实现,安装Jeky需要搭建Ruby环境,在Windows搭建Ruby环境并不是被推荐的,而 Hexo基于NodeJs实现,在Windows上安装NodeJs开发环境简单。
Jekyll没有本地服务器,无法实现本地博文预览功能,需要上传到WEB容器中才能预览功能,而Hexo可以通过简单的命令实现本地的预览,并直接发布到WEB容器中实现同步。
比较直接的另一个原因是在网上查找了很多博客的主题,发现Jekyll官网提供的主题都不怎么好看(可能是个人原因),而Hexo的主题看的比较顺眼。
两者都支持Markdown语法,这点我非常喜欢。
相关文章推荐
- 使用hexo搭建github.io博客
- 新博客(Hexo)地址:http://leoios.github.io
- 用hexo书写github.io博客 学习心得 教程
- 使用hexo搭建github.io博客(一)
- 【Hexo】Hexo+Github构建个人博客 (五):错误集
- hexo+github快速搭建个人博客
- 使用GitHub + Hexo搭建个人博客(五)- Ubuntu升级后hexo命令失效
- Hexo搭建Github Pages托管的静态个人博客
- hexo+github搭建个人博客
- 在github上使用hexo搭建博客简明教程
- 基于Hexo+GitHub Page搭建免费个人博客教程
- 使用Hexo和Github Pages搭建个人独立的博客
- 手把手教从零开始在GitHub上使用Hexo搭建博客教程(一)-附GitHub注册及配置
- hexo框架-next主题-github搭建个人博客
- hexo搭建github博客
- 使用GitHub Pages + Hexo 快速搭建个性化博客(七)-编辑博文
- hexo建立github,gitcafe博客并实时同步的要点
- Hexo3.0和Github搭建博客
- 使用github和hexo搭建静态博客