参考:
https://blog.csdn.net/a_jie_2016_05/article/details/82178581
https://www.cnblogs.com/Camiluo/p/10996934.html
查了资料发现是Centos默认支持ruby到2.0.0,可gem 安装redis需要最低是2.3.0
解决办法是 先安装rvm,再把ruby版本提升至2.3.0
$ yum install curl
$ curl -L get.rvm.io | bash -s stable
$ curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
$ curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
再次 $ curl -L get.rvm.io | bash -s stable
$ find / -name rvm.sh
$ source /etc/profile.d/rvm.sh
$ rvm requirements
$ rvmsudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel
$ source /usr/local/rvm/scripts/rvm
查看rvm库中已知的ruby版本
$ rvm list known
安装一个ruby版本
$ rvm install 2.6.3
使用一个ruby版本
$ rvm use 2.6.3
设置默认版本
$ rvm remove 2.0.0
卸载一个已知版本
$ ruby --version
再安装redis就可以了
$ gem install redis
root权限安装所需依赖
$ yum install ruby
$ yum install ruby-irb
$ yum install ruby-devel
$ yum install gem
使用gem 安装jekyll扩展库
$ gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
若报错改为: gem sources -a https://gems.ruby-china.com/ 查看 gem sources -l
$ gem install bundle
$ bundle install
$ gem install minima
$ gem install jekyll
非root权限构建jekyll
$ jekyll build
$ jekyll new apidocs
$ cd apidocs/
修改host
$ vi _config.yml
$ jekyll server -H 127.0.0.1
测试页面是否成功
浏览器访问:https://127.0.0.1:4000/
$ jekyll server -H 127.0.0.1 --incremental
将此脚本命令设置为后台执行,SSH客户端断开继续执行
$ ctrl + z
$ bg 1
$ disown -h %1