Ubuntu 用 apt-get install ruby-rvm安装 rvm 不能安装ruby2.0.0以上的版本
删除:
sudo apt-get --purge remove ruby-rvm
sudo rm -rf /usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/rvm.sh
1:安装rvm
root用户安装
\curl -L https://get.rvm.io |
bash -s stable --ruby --autolibs=enable --auto-dotfiles
root@ubuntu100:~# \curl -L https://get.rvm.io |
> bash -s stable --ruby --autolibs=enable --auto-dotfiles
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 184 100 184 0 0 166 0 0:00:01 0:00:01 --:--:-- 265
100 22702 100 22702 0 0 13712 0 0:00:01 0:00:01 --:--:-- 13712
Turning on auto dotfiles mode.
Downloading https://github.com/wayneeseguin/rvm/archive/1.26.3.tar.gz
Downloading https://github.com/wayneeseguin/rvm/releases/download/1.26.3/1.26.3.tar.gz.asc
curl: (22) The requested URL returned error: 403
Could not download 'https://github.com/wayneeseguin/rvm/releases/download/1.26.3/1.26.3.tar.gz.asc'.
curl returned status '22'.
Upgrading the RVM installation in /usr/local/rvm/
test -f /etc/profile.d/rvm.sh && source /etc/profile.d/rvm.sh
Upgrade of RVM in /usr/local/rvm/ is complete.
# Administrator,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.
In case of problems: http://rvm.io/help and https://twitter.com/rvm_io
Upgrade Notes:
* No new notes to display.
rvm 1.26.3 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/12.04/x86_64/ruby-2.1.5.tar.bz2
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system............
Installing required packages: gawk, libreadline6-dev, libyaml-dev, sqlite3, libgdbm-dev, libncurses5-dev, pkg-config, libffi-dev........
Requirements installation successful.
ruby-2.1.5 - #configure
ruby-2.1.5 - #download
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:01:00 --:--:-- 0
Warning: Transient problem: HTTP error Will retry in 2 seconds. 3 retries
Warning: left.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
32 21.4M 32 7248k 0 0 39944 0 0:09:24 0:03:05 0:06:19 31591
curl: (18) transfer closed with 15112901 bytes remaining to read
Partial file(18). Only a part of the file was transferred. Removing partial and re-trying.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 21.4M 100 21.4M 0 0 51199 0 0:07:20 0:07:20 --:--:-- 52087
Checking fallback: ftp://rvm_io.global.ssl.fastly.net/binaries/ubuntu/12.04/x86_64/ruby-2.1.5.tar.bz2?rvm=1.26.3
Checking fallback: http://www.mirrorservice.org/sites/rvm_io.global.ssl.fastly.net/binaries/ubuntu/12.04/x86_64/ruby-2.1.5.tar.bz2?rvm=1.26.3
No fallback URL could be found, try increasing timeout with:
echo "export rvm_max_time_flag=20" >> ~/.rvmrc
Downloading https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/12.04/x86_64/ruby-2.1.5.tar.bz2 failed.
Mounting remote ruby failed with status 2, trying to compile.
Checking requirements for ubuntu.
Requirements installation successful.
Found user configured '-j' flag in 'rvm_make_flags', please note that RVM can detect number of CPU threads and set the '-j' flag automatically if you do not set it.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.1.5, this may take a while depending on your cpu(s)...
ruby-2.1.5 - #downloading ruby-2.1.5, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 11.4M 100 11.4M 0 0 82676 0 0:02:25 0:02:25 --:--:-- 112k
ruby-2.1.5 - #extracting ruby-2.1.5 to /usr/local/rvm/src/ruby-2.1.5....
ruby-2.1.5 - #configuring.....................................................
ruby-2.1.5 - #post-configuration..
ruby-2.1.5 - #compiling..........................................................................................
ruby-2.1.5 - #installing..................................
ruby-2.1.5 - #making binaries executable..
ruby-2.1.5 - #downloading rubygems-2.4.4
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 433k 100 433k 0 0 100k 0 0:00:04 0:00:04 --:--:-- 129k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.1.5 - #extracting rubygems-2.4.4....
ruby-2.1.5 - #removing old rubygems.........
ruby-2.1.5 - #installing rubygems-2.4.4..............
ruby-2.1.5 - #gemset created /usr/local/rvm/gems/ruby-2.1.5@global
ruby-2.1.5 - #importing gemset /usr/local/rvm/gemsets/global.gems...........................................................
ruby-2.1.5 - #generating global wrappers........
ruby-2.1.5 - #gemset created /usr/local/rvm/gems/ruby-2.1.5
ruby-2.1.5 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.1.5 - #generating default wrappers........
ruby-2.1.5 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.1.5 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
Creating alias default for ruby-2.1.5...
* To start using RVM you need to run `source /usr/local/rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
另外开个shell就生效了,或source /usr/local/rvm/scripts/rvm
2:检查
root@ubuntu100:~# rvm -v
rvm 1.26.3 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
root@ubuntu100:~# gem -v
2.4.4
root@ubuntu100:~# ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]
3:安装rails
root@ubuntu100:/home# gem install rails
Fetching: thread_safe-0.3.4.gem (100%)
Successfully installed thread_safe-0.3.4
Fetching: minitest-5.4.3.gem (100%)
Successfully installed minitest-5.4.3
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: i18n-0.6.11.gem (100%)
Successfully installed i18n-0.6.11
Fetching: activesupport-4.1.8.gem (100%)
Successfully installed activesupport-4.1.8
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: builder-3.2.2.gem (100%)
Successfully installed builder-3.2.2
Fetching: actionview-4.1.8.gem (100%)
Successfully installed actionview-4.1.8
Fetching: rack-1.5.2.gem (100%)
Successfully installed rack-1.5.2
Fetching: rack-test-0.6.2.gem (100%)
Successfully installed rack-test-0.6.2
Fetching: actionpack-4.1.8.gem (100%)
Successfully installed actionpack-4.1.8
Fetching: tilt-1.4.1.gem (100%)
Successfully installed tilt-1.4.1
Fetching: multi_json-1.10.1.gem (100%)
Successfully installed multi_json-1.10.1
Fetching: hike-1.2.3.gem (100%)
Successfully installed hike-1.2.3
Fetching: sprockets-2.12.3.gem (100%)
Successfully installed sprockets-2.12.3
Fetching: sprockets-rails-2.2.0.gem (100%)
Successfully installed sprockets-rails-2.2.0
Fetching: thor-0.19.1.gem (100%)
Successfully installed thor-0.19.1
Fetching: railties-4.1.8.gem (100%)
Successfully installed railties-4.1.8
Fetching: mime-types-2.4.3.gem (100%)
Successfully installed mime-types-2.4.3
Fetching: mail-2.6.3.gem (100%)
Successfully installed mail-2.6.3
Fetching: actionmailer-4.1.8.gem (100%)
Successfully installed actionmailer-4.1.8
Fetching: arel-5.0.1.20140414130214.gem (100%)
Successfully installed arel-5.0.1.20140414130214
Fetching: activemodel-4.1.8.gem (100%)
Successfully installed activemodel-4.1.8
Fetching: activerecord-4.1.8.gem (100%)
Successfully installed activerecord-4.1.8
Fetching: rails-4.1.8.gem (100%)
Successfully installed rails-4.1.8
Parsing documentation for thread_safe-0.3.4
Installing ri documentation for thread_safe-0.3.4
Parsing documentation for minitest-5.4.3
Installing ri documentation for minitest-5.4.3
Parsing documentation for tzinfo-1.2.2
Installing ri documentation for tzinfo-1.2.2
Parsing documentation for i18n-0.6.11
Installing ri documentation for i18n-0.6.11
Parsing documentation for activesupport-4.1.8
Installing ri documentation for activesupport-4.1.8
Parsing documentation for erubis-2.7.0
Installing ri documentation for erubis-2.7.0
Parsing documentation for builder-3.2.2
Installing ri documentation for builder-3.2.2
Parsing documentation for actionview-4.1.8
Installing ri documentation for actionview-4.1.8
Parsing documentation for rack-1.5.2
Installing ri documentation for rack-1.5.2
Parsing documentation for rack-test-0.6.2
Installing ri documentation for rack-test-0.6.2
Parsing documentation for actionpack-4.1.8
Installing ri documentation for actionpack-4.1.8
Parsing documentation for tilt-1.4.1
Installing ri documentation for tilt-1.4.1
Parsing documentation for multi_json-1.10.1
Installing ri documentation for multi_json-1.10.1
Parsing documentation for hike-1.2.3
Installing ri documentation for hike-1.2.3
Parsing documentation for sprockets-2.12.3
Installing ri documentation for sprockets-2.12.3
Parsing documentation for sprockets-rails-2.2.0
Installing ri documentation for sprockets-rails-2.2.0
Parsing documentation for thor-0.19.1
Installing ri documentation for thor-0.19.1
Parsing documentation for railties-4.1.8
Installing ri documentation for railties-4.1.8
Parsing documentation for mime-types-2.4.3
Installing ri documentation for mime-types-2.4.3
Parsing documentation for mail-2.6.3
Installing ri documentation for mail-2.6.3
Parsing documentation for actionmailer-4.1.8
Installing ri documentation for actionmailer-4.1.8
Parsing documentation for arel-5.0.1.20140414130214
Installing ri documentation for arel-5.0.1.20140414130214
Parsing documentation for activemodel-4.1.8
Installing ri documentation for activemodel-4.1.8
Parsing documentation for activerecord-4.1.8
Installing ri documentation for activerecord-4.1.8
Parsing documentation for rails-4.1.8
Installing ri documentation for rails-4.1.8
Done installing documentation for thread_safe, minitest, tzinfo, i18n, activesupport, erubis, builder, actionview, rack, rack-test, actionpack, tilt, multi_json, hike, sprockets, sprockets-rails, thor, railties, mime-types, mail, actionmailer, arel, activemodel, activerecord, rails after 670 seconds
25 gems installed
root@ubuntu100:/home# rails -v
Rails 4.1.8