通过反复安装和网上找的资料,记录安装过程如下,
使用默认官方的源来更新,否则会出现莫名其妙的问题,
sudo apt-get install build-essential patch
sudo apt-get install ruby-dev zlib1g-dev liblzma-dev
sudo apt-get update
sudo apt-get upgrade
$ rub。y -v
ruby 2.3.1p112
安装好后再更换国内的源,
$ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
$ gem sources -l
https://gems.ruby-china.org
# 确保只有 gems.ruby-china.org
$ sudo gem update --system
$ gem -v
2.6.7
sudo apt install ruby-bundler
$ bundle config mirror.https://rubygems.org https://gems.ruby-china.org
$ rails -v
Rails 5.1.3