Install RVM and Ruby 1.9.x - Linux
RVM installation is more straightforward on Linux, as the Ruby source wasdesigned for the GCC compiler that ships with any Linux distribution.
First install curl
, so that you can fetch the RVM script.For Ubuntu, runthe following command:
$ sudo apt-get update
$ sudo apt-get install -y curl
For RedHat/CentOS:
$ sudo yum update
$ sudo yum install -y curl
With curl installed, run the RVM install with the following commands:
$ \curl -L https://get.rvm.io | bash -s stable
$ source $HOME/.rvm/scripts/rvm
On Ubuntu, run rvm requirements
to install additional dependencies:
$ rvm requirements
For CentOS, rvm requirements
will need to download packages from EPEL, soadd the --verify-downloads 1
parameter after the rvm requirements
command:
$ rvm requirements --verify-downloads 1
Next build and install Ruby 1.9.3 (this will take awhile):
$ rvm install 1.9.3
$ rvm use 1.9.3
$ rvm rubygems latest
Verify rvm install:
$ rvm -h
$ rvm list
$ rvm use 1.9.3
$ ruby -v
ruby 1.9.3p429 (2013-05-15 revision 40747) [x86_64-linux]
Install Ruby 2.0.0 - Linux
Installing Ruby 2.0 is very straightforward, just run the following:
$ rvm install 2.0.0
Verify the Ruby 2.0 install by running the following commands:
$ rvm use 2.0.0
$ ruby -v
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]
If you want to make Ruby 2.0 your default version of ruby, run the following:
$ rvm use 2.0.0 --default
Remove RVM - Linux
Should you want to uninstall/remove RVM, it’s pretty easy. First, runthe following commands:
$ rvm implode
$ gem uninstall rvm
Then just follow the instructions from rvm implode
:
-
Delete the following files, if they exist:
/etc/rvmrc
$HOME/.rvmrc
-
Also, remove the lines sourcing RVM scripts from
$HOME/.bash_profile
/etc/zprofile
and/etc/profile.d/rvm.sh
if they exist. (A reboot doesn’t hurtafter you do this, just to make sure).