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