一.安装Rvm
1.下载安装Rvm
$ curl -L https://get.rvm.io | bash -s stable
此时可能出现错误:“gpg: 无法检查签名:找不到公钥”
解决方法:
$ gpg --keyserver subkeys.pgp.net --recv 4F6C1E86 //下划线上应改为你所缺少的公钥 $ gpg --export --armor 4F6C1E86 | sudo apt-key add - //下划线上应改为你所缺少的公钥
2.载入Rvm环境
$ source ~/.rvm/scripts/rvm
3.检查是否安装正确
$ rvm -v rvm 1.22.17 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
二.用 RVM 安装 Ruby 环境
1.下载安装Ruby,Ruby Gems;
$ rvm install 2.0.0
2.将安装好的Ruby设置为系统默认版本
$ rvm 2.0.0 --default
此时可能出现错误:RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
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
三.安装Bundler
$ 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/
四. 安装Rails环境
1.安装Rails
$ gem install rails
2.检查是否正确
$ rails -v Rails 3.2.13
**********声明:根据个人系统初始配置的不同,解决错误的方法也不尽相同,以上方法仅供参考**********
转载自本人ITeye链接:http://xiaozhuang0706.iteye.com/blog/2256879