1.下載安裝Rvmshell
$ curl -L https://get.rvm.io | bash -s stable
此時可能出現錯誤:「gpg: 沒法檢查簽名:找不到公鑰」api
解決方法:ruby
$ gpg --keyserver subkeys.pgp.net --recv 4F6C1E86 //下劃線上應改成你所缺乏的公鑰
$ gpg --export --armor 4F6C1E86 | sudo apt-key add - //下劃線上應改成你所缺乏的公鑰
2.載入Rvm環境bash
$ source ~/.rvm/scripts/rvm
3.檢查是否安裝正確curl
$ rvm -v
rvm 1.22.17 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
1.下載安裝Ruby,Ruby Gems;測試
$ rvm install 2.0.0
2.將安裝好的Ruby設置爲系統默認版本ui
$ rvm 2.0.0 --default
此時可能出現錯誤:RVM is not a function, selecting rubies with 'rvm use ...' will not work.url
You need to change your terminal emulator preferences to allow login shell.spa
Sometimes it is required to use `/bin/bash --login` as the command..net
Please visit https://rvm.io/integration/gnome-terminal/ for an example.
解決方法:
$ bash --login
3.測試是否正確
$ ruby -v ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin13.0.0] $ gem -v 2.1.6
$ gem install bundler
此時可能出現錯誤:
ERROR: Could not find a valid gem 'bundler' (>= 0), here is why: Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Connection timed out - connect(2) (https://rubygems.org/latest_specs.4.8.gz)
解決方法:
$ gem sources --remove https://rubygems.org/ https://rubygems.org/ removed from sources $ gem sources -a https://ruby.taobao.org/ https://ruby.taobao.org/ added to sources $ gem sources -l *** CURRENT SOURCES *** https://ruby.taobao.org/
1.安裝Rails
$ gem install rails
2.檢查是否正確
$ rails -v
Rails 3.2.13
**********聲明:根據我的系統初始配置的不一樣,解決錯誤的方法也不盡相同,以上方法僅供參考**********
轉載自本人ITeye連接:http://xiaozhuang0706.iteye.com/blog/2256879