ubuntu12.04安装ruby2.3

为了搭建github-pages博客,而github-pages后端依赖于ruby,且对版本有严格要求,自己尝试了各种姿势升级ruby2.3无果,最终在查阅了各种资料之后找到一个可行方案。

icebug@localhost:~$ sudo apt-get -y install software-properties-common 
icebug@localhost:~$ sudo apt-add-repository ppa:brightbox/ruby-ng 
icebug@localhost:~$ sudo apt-get update
icebug@localhost:~$ sudo apt-get -y install ruby2.3

同时不要忘记了安装ruby2.3的开发库,不然还是会遇到各种坑.....

icebug@localhost:~$ sudo apt-get install ruby2.3-dev

升级ruby到2.3之后执行

bundler update

还是出现以下错误

奇怪的是竟然不影响github-pages的安装

icebug@localhost:~$ sudo gem install github-pages

运行jekyll server

icebug@localhost:~$ bundle exec jekyll serve

设定jekyll server监听IP,这个跟Flask和Django差不多,直接在后面加上--host参数就OK

icebug@localhost:~$ bundle exec jekyll server --host=0.0.0.0

默认会监听4000端口

原文地址:https://www.cnblogs.com/dspace/p/6103008.html