How to install multiple ruby version with Ruby Version Manager (RVM) on Amazon Linux AMI/ CentOS 6.4/ RHEL/ Fedora
Ruby Version Manager or RVM is a unix-like application designed to manage multiple Ruby installations on the same machine. We can switch between the different versions to work on different projects with different version requirements.
In this article I will show you how to install ruby 1.9.3 and 2.0.0 version on a same machine using RVM.
Upgrade your packages:
1
|
yum update
|
Install Recomented packages:
1
|
yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel
|
Now we will install the latest stable version of RVM by issuing below command.
1
|
curl -L get.rvm.io | bash -s stable
|
After installation complete we have to configure RVM environment. Issue below command:
1
|
source /etc/profile.d/rvm.sh
|
Now we will install ruby version 2.0.0. List all the available ruby version by issuing below command:
1
|
rvm list known
|
Now we can install ruby 2.0.0 latest patch level or install any patch-level by picking from the displayed list:
To install the latest patch level of 2.0.0 issue the below command:
1
|
rvm install 2.0.0
|
You will see the out put like below:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
Searching for binary rubies, this might take some time.
Checking requirements for amazon.
Requirements installation successful.
ruby-2.0.0-p247 - #configure
ruby-2.0.0-p247 - #download
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 17.5M 100 17.5M 0 0 743k 0 0:00:24 0:00:24 --:--:-- 792k
ruby-2.0.0-p247 - #validate archive
ruby-2.0.0-p247 - #extract
ruby-2.0.0-p247 - #validate binary
ruby-2.0.0-p247 - #setup
Saving wrappers to '/usr/local/rvm/wrappers/ruby-2.0.0-p247'........
ruby-2.0.0-p247 - #importing default gemsets, this may take time.......................
|
To install a particular patch level issue below command:
1
|
rvm install 2.0.0-p195
|
Install ruby version 1.9.3
1
|
rvm install 1.9.3
|
After completing the installation now we can verify the installed ruby versions on our machine by issuing below command:
1
|
rvm list
|
Now to switch the ruby versions issue the below command:
1
2
3
4
5
6
|
#To use ruby version 1.9.3
rvm use 1.9.3
#or to use ruby version 2.0.0-p247
rvm use 2.0.0-p247
#To use ruby version 2.0.0-p195
rvm use 2.0.0-p195
|
Verify the ruby versions after every switch by issuing the below command:
1
|
ruby -v
|
To setup default ruby version use the below command:
1
|
rvm use 2.0.0-p247 --default
|
댓글 없음:
댓글 쓰기