作为一名程序员,拥有一个自己的网站是非常值得装X的意见事情,那么做为一名C++的程序员,想要有一个网站就要去学习前端的内容。这样又是十分的艰难,所以我采用使用GitHub Pages+ Jekyll建立属于自己的网站
Github Pages
jekyll
需要安装的软件
我们在查看博客效果的时候,需要预览我没问你调节的样式。所以我们要搭建调试环境,我们在Ubuntu下做环境搭建。
需要安装的软件 | 执行的命令 |
---|---|
ruby | sudo apt-get install ruby |
ruby-dev | sudo apt-get install ruby-dev |
jekyll | sudo gem install jekyll |
bundler | sudo gem install bundler |
nodejs | sudo apt-get install nodejs |
知识点
source 'https://rubygems.org'
gem 'rails', '4.1.0.rc2'
gem 'rack-cache'
gem 'nokogiri', '~> 1.6.1'
首先由于Ubuntu使用的12的,所以自带的Ruby的版本是1.8的,这哥版本还没有自带gem,所以我通过源码安装了ruby2.4.4,因为2.0以上的版本安装gem,并且2.4的版本比较稳定。
首先安装ruby2.4.4
下载地址
https://download.csdn.net/download/osean_li/10528636
解压后安装
1
$ tar zxvf ruby-2.4.4.tar.gz
$ cd ruby-2.4.4
$ ./configure
$ make
$ sudo make install
在安装的
sudo gem install jekyll
的时候可能会有下面的提示错误
检测bundler是否安装成功
bundle show
Could not find gem 'minima (~> 2.0)' in any of the gem sources listed in your
Gemfile.
'
缺少minima
sudo gem install minima
安装
2
错误提示
Could not find jekyll-paginate-1.1.0 in any of the sources
安装jekyll-paginate
sudo gem install jekyll-paginate
3
错误提示
in any of the gem sources listed in your Gemfile.
说明·Gemfile·中有的包,可能没有安装
4
错误提示
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
先看一下 $openssl version 是不是安装了 OpenSSL
OpenSSL 0.9.8zh 14 Jan 2016
恩,有版本
那就更换源 的地址
删除 https 源
$gem source -r https://rubygems.org/
to remove
添加 http 源
$gem source -a http://rubygems.org/ to read
确保添加正确
$gem source
*** CURRENT SOURCES ***
http://rubygems.org/
$ jekyll new myblog
2进入myblog目录:
cd myblog/
执行bundle exec jekyll serve
如上图执行成功
在浏览器中输入
http://127.0.0.1:4000
就能够看见当前我们博客的样式
如果提示
jekyll 3.8.3 | Error: Address already in use - bind(2) for 127.0.0.1:4000
说明已经启用了一次jekyll serve,
ps -ef
查找左右的进程 找出pid
kill -9 19148
19148 是jekyll serve服务的PID,强制杀死,在启动就ok了。
至此调试环境就搭建好了。下面就是美化我们的网站,在提交到github上就好了。
https://blog.csdn.net/fengbingchun/article/details/61614738
https://www.cnblogs.com/xsyl/p/6085833.html