為了搭建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端口