What CentOS version are you running?
First, confirm what version of CentOS you're running:$ cat /etc/issue CentOS release 5.6 (Final)
As you can see, I'm running 5.6, but these instructions may work for earlier versions.
What git version are you running?
The RVM installation instructions recommend having git version 1.7 or later. What do I have?$ git --version git version 1.6.1I'm okay with this for the moment. The standard CentOS repositories do not have a newer version; in the CentOS universe, this is the latest version of Git (although you could get a newer version by adding a different repo). If I run into trouble later, I'll have this potential git upgrade as a possible solution.
What terminal are you running?
I believe the RVM installation instructions assume you are using Bash as a terminal. Check what terminal you are using by running the following command:$ ps -p$$ -ocmd= ps -p$$ -ocmd= bash -vThat tells me I'm running bash. Confirm by asking it for the specific version:
$ bash --version bash --version GNU bash, version 3.2.25(1)-release (i686-redhat-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc.
Installation: Three steps
The installation instructions list three steps for completing the RVM installation package:- Download and run the RVM installation script
- Load RVM into your shell sessions as a function
- Reload shell configuration & test
Download and run the RVM installation script
Copy the following line into your terminal:$ bash < <(curl -sk https://rvm.beginrescueend.com/install/rvm)For me, this produced the following output:
Initialized empty Git repository in /home/arsturges/.rvm/src/rvm/.git/ remote: Counting objects: 4930, done. remote: Compressing objects: 100% (2305/2305), done. remote: Total 4930 (delta 3194), reused 3552 (delta 1943) Receiving objects: 100% (4930/4930), 1.60 MiB | 1646 KiB/s, done. Resolving deltas: 100% (3194/3194), done. RVM: Shell scripts enabling management of multiple ruby environments. RTFM: https://rvm.beginrescueend.com/ HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net) Installing RVM to /home/arsturges/.rvm/~/.rvm ~/.rvm/src/rvm ~/.rvm/src/rvm Correct permissions for base binaries in /home/arsturges/bin... Copying manpages into place. Notes for Linux ( CentOS release 5.6 (Final) ) NOTE: 'ruby' represents Matz's Ruby Interpreter (MRI) (1.8.X, 1.9.X) This is the *original* / standard Ruby Language Interpreter 'ree' represents Ruby Enterprise Edition 'rbx' represents Rubinius bash >= 3.2 is required curl is required git is required (>= 1.7 recommended) patch is required (for ree and some ruby-head's). If you wish to install rbx and/or Ruby 1.9 head (MRI) (eg. 1.9.2-head), then you must install and use rvm 1.8.7 first. If you wish to have the 'pretty colors' again, set 'export rvm_pretty_print_flag=1' in ~/.rvmrc. dependencies: # For RVM rvm: yum install -y bash curl git # NOTE: For git you need the EPEL repository enabled # For Ruby (MRI & Ree) you should install the following OS dependencies: ruby: yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel ; yum install -y make bzip2 ; yum install -y iconv-devel # NOTE: For centos 5.4 final iconv-devel might not be available :( # For JRuby (if you wish to use it) you will need: jruby: yum install -y java For rbx (Rubinius) more then 600MB of free RAM required. You must now complete the install by loading RVM in new shells. 1) Place the folowing line at the end of your shell's loading files (.bashrc or .bash_profile for bash and .zshrc for zsh), after all PATH/variable settings: [[ -s "/home/arsturges/.rvm/scripts/rvm" ]] && source "/home/arsturges/.rvm/scripts/rvm" # This loads RVM into a shell session. You only need to add this line the first time you install rvm. 2) Ensure that there is no 'return' from inside the ~/.bashrc file, otherwise rvm may be prevented from working properly. This means that if you see something like: '[ -z "$PS1" ] && return' then you change this line to: if [[ -n "$PS1" ]] ; then # ... original content that was below the '&& return' line ... fi # <= be sure to close the if at the end of the .bashrc. # This is a good place to source rvm v v v [[ -s "/home/arsturges/.rvm/scripts/rvm" ]] && source "/home/arsturges/.rvm/scripts/rvm" # This loads RVM into a shell session. EOF - This marks the end of the .bashrc file Be absolutely *sure* to REMOVE the '&& return'. If you wish to DRY up your config you can 'source ~/.bashrc' at the bottom of your .bash_profile. Placing all non-interactive (non login) items in the .bashrc, including the 'source' line above and any environment settings. 3) CLOSE THIS SHELL and open a new one in order to use rvm. Installation of RVM to /home/arsturges/.rvm/ is complete. Andy Sturges, Thank you very much for using RVM! I sincerely hope that RVM helps to make your work both easier and more enjoyable. If you have any questions, issues and/or ideas for improvement please join#rvm on irc.freenode.net and let me know, note you must register (http://bit.ly/5mGjlm) and identify (/msg nickservNotice a few things about this comprehensive output:) to talk, this prevents spambots from ruining our day. My irc nickname is 'wayneeseguin' and I hang out in #rvm typically ~09:00-17:00EDT and again from ~21:00EDT-~23:00EDT If I do not respond right away, please hang around after asking your question, I will respond as soon as I am back. It is best to talk in #rvm itself as then other users can help out should I be offline. Be sure to get head often as rvm development happens fast, you can do this by running 'rvm get head' followed by 'rvm reload' or opening a new shell w⦿‿⦿t ~ Wayne
- Wayne has customized his installation script (which produced this file) to produce output specific to my linux distribution (CentOS 5.6). This means he provides "yum" commands, instead of, say, Ubuntu's "apt-get".
- He notes several dependencies:
dependencies: # For RVM rvm: yum install -y bash curl git # NOTE: For git you need the EPEL repository enabled # For Ruby (MRI & Ree) you should install the following OS dependencies: ruby: yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel ; yum install -y make bzip2 ; yum install -y iconv-devel # NOTE: For centos 5.4 final iconv-devel might not be available :(
We can run these commands as-is, which I'll do below. - He gives us three steps to complete the installation:
- Place the folowing line at the end of your shell's loading files
(.bashrc or .bash_profile for bash and .zshrc for zsh),
after all PATH/variable settings: - Ensure that there is no 'return' from inside the ~/.bashrc file,
otherwise rvm may be prevented from working properly. - CLOSE THIS SHELL and open a new one in order to use rvm.
- Place the folowing line at the end of your shell's loading files
- It talks about editing the .bashrc or .bash_profile. This can be done by using the vim text editor at the command line from your home (~) director:
$ cd ~ $ vim .bashrc $ vim .bash_profile
Meet RVM's listed dependencies
As noted in the script output above, we should meet RVM's and Ruby's dependencies. I don't care about JRuby or other editions, so I'll ignore their dependencies. Copying the line from above:$ yum install -y bash curl Loaded plugins: fastestmirror You need to be root to perform this command.I need to be root, so I'll re-run the command, only prepending "sudo" in front of it:
$ sudo yum install -y bash curl [sudo] password for arsturges: Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centos.mirror.facebook.net * extras: mirror.nwresd.org * rpmforge: ftp-stud.fht-esslingen.de * updates: centos.mirrors.hoobly.com Setting up Install Process Package bash-3.2-24.el5.i386 already installed and latest version Package curl-7.15.5-9.el5_6.2.i386 already installed and latest version Nothing to doThis tells me those packages are all up-to-date. Next, try the Ruby OS dependencies (again adding "sudo"):
sudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-develThis gives me the following output:
$ sudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centos.mirror.facebook.net * extras: mirror.5ninesolutions.com * rpmforge: ftp-stud.fht-esslingen.de * updates: centos.mirrors.hoobly.com Setting up Install Process Package gcc-c++-4.1.2-50.el5.i386 already installed and latest version Package patch-2.5.4-31.el5.i386 already installed and latest version Package readline-5.1-3.el5.i386 already installed and latest version Package readline-devel-5.1-3.el5.i386 already installed and latest version Package zlib-1.2.3-3.i386 already installed and latest version Package zlib-devel-1.2.3-3.i386 already installed and latest version Package openssl-devel-0.9.8e-12.el5_5.7.i386 already installed and latest version Resolving Dependencies --> Running transaction check ---> Package libffi-devel.i386 0:3.0.9-1.el5.rf set to be updated --> Processing Dependency: libffi = 3.0.9-1.el5.rf for package: libffi-devel --> Processing Dependency: libffi.so.5 for package: libffi-devel ---> Package libyaml-devel.i386 0:0.1.3-1.el5.rf set to be updated --> Processing Dependency: libyaml = 0.1.3-1.el5.rf for package: libyaml-devel --> Processing Dependency: libyaml-0.so.2 for package: libyaml-devel --> Running transaction check ---> Package libffi.i386 0:3.0.9-1.el5.rf set to be updated ---> Package libyaml.i386 0:0.1.3-1.el5.rf set to be updated --> Finished Dependency Resolution Dependencies Resolved ==================================================================================== Package Arch Version Repository Size ==================================================================================== Installing: libffi-devel i386 3.0.9-1.el5.rf rpmforge 16 k libyaml-devel i386 0.1.3-1.el5.rf rpmforge 12 k Installing for dependencies: libffi i386 3.0.9-1.el5.rf rpmforge 87 k libyaml i386 0.1.3-1.el5.rf rpmforge 115 k Transaction Summary ==================================================================================== Install 4 Package(s) Upgrade 0 Package(s) Total download size: 230 k Downloading Packages: (1/4): libyaml-devel-0.1.3-1.el5.rf.i386.rpm | 12 kB 00:00 (2/4): libffi-devel-3.0.9-1.el5.rf.i386.rpm | 16 kB 00:00 (3/4): libffi-3.0.9-1.el5.rf.i386.rpm | 87 kB 00:00 (4/4): libyaml-0.1.3-1.el5.rf.i386.rpm | 115 kB 00:00 ------------------------------------------------------------------------------------ Total 84 kB/s | 230 kB 00:02 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : libyaml 1/4 Installing : libffi 2/4 Installing : libffi-devel 3/4 Installing : libyaml-devel 4/4 Installed: libffi-devel.i386 0:3.0.9-1.el5.rf libyaml-devel.i386 0:0.1.3-1.el5.rf Dependency Installed: libffi.i386 0:3.0.9-1.el5.rf libyaml.i386 0:0.1.3-1.el5.rf Complete!As you can see, it found most of those packages installed and up-to-date, but it did find some new ones as well, which it installed without issue.
The next two lines I'll run together, as Wayne wrote them, split by a semi-collon:
sudo yum install -y make bzip2; sudo yum install -y iconv-develWithout listing all the output, I'll say that these packages were found to be up-to-date.
Now that we've met all the listed dependencies, we continue by following the enumerated instructions. Step one is: Place the folowing line at the end of your shell's loading files (.bashrc or .bash_profile for bash and .zshrc for zsh), after all PATH/variable settings:
[[ -s "/home/arsturges/.rvm/scripts/rvm" ]] && source "/home/arsturges/.rvm/scripts/rvm" # This loads RVM into a shell session.The .bashrc file is run each time you open a Bash shell terminal window, and since we'll be running RVM througha Bash shell, this line will be invoked before we ever need to use RVM. To add it, simply copy it, open the file with vim, and paste it in as the last line in the file.
$ cd ~ $ vim .bashrcHere's what my file looks like after I've added the line:
# .bashrc # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # User specific aliases and functions [[ -s "/home/arsturges/.rvm/scripts/rvm" ]] && source "/home/arsturges/.rvm/scripts/rvm" # This loads RVM into a shell session.The next step, according the instructions:
Ensure that there is no 'return' from inside the ~/.bashrc file
The script instructs us to "Ensure that there is no 'return' from inside the ~/.bashrc file,otherwise rvm may be prevented from working properly." I checked mine and saw no such thing, so I'll continue.
Restart the shell
The next step: "CLOSE THIS SHELL and open a new one in order to use rvm." Just close and re-open the terminal window.That's it for the script instructions. To see what to do next, we return to the on-line instructions, where we've basically completed step three. The next thing to do is see if it worked.
Test the installation
Type the following command, which should return the phrase "rvm is a function":$ type rvm | head -1 rvm is a functionI have no idea what that does or why it worked, but as you can see, it worked for me. Now run
rvm notes
as recommended:$ rvm notes Notes for Linux ( CentOS release 5.6 (Final) ) NOTE: 'ruby' represents Matz's Ruby Interpreter (MRI) (1.8.X, 1.9.X) This is the *original* / standard Ruby Language Interpreter 'ree' represents Ruby Enterprise Edition 'rbx' represents Rubinius bash >= 3.2 is required curl is required git is required (>= 1.7 recommended) patch is required (for ree and some ruby-head's). If you wish to install rbx and/or Ruby 1.9 head (MRI) (eg. 1.9.2-head), then you must install and use rvm 1.8.7 first. If you wish to have the 'pretty colors' again, set 'export rvm_pretty_print_flag=1' in ~/.rvmrc. dependencies: # For RVM rvm: yum install -y bash curl git # NOTE: For git you need the EPEL repository enabled # For Ruby (MRI & Ree) you should install the following OS dependencies: ruby: yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel ; yum install -y make bzip2 ; yum install -y iconv-devel # NOTE: For centos 5.4 final iconv-devel might not be available :( # For JRuby (if you wish to use it) you will need: jruby: yum install -y java For rbx (Rubinius) more then 600MB of free RAM required.This just reminds us of the dependencies we've already met for Ruby, and of the dependencies we'd need to meet if we wanted to run JRuby or rbx. Otherwise, we should be done with the installation, and ready to use RVM on CentOS 5.6.
Try it out
$ rvm list known # MRI Rubies [ruby-]1.8.6[-p420] [ruby-]1.8.6-head [ruby-]1.8.7[-p334] [ruby-]1.8.7-head [ruby-]1.9.1-p378 [ruby-]1.9.1[-p431] [ruby-]1.9.1-head [ruby-]1.9.2[-p180] [ruby-]1.9.2-head ruby-head # GoRuby goruby # JRuby jruby-1.2.0 jruby-1.3.1 jruby-1.4.0 jruby-1.6.0 jruby-1.6.1 jruby[-1.6.2] jruby-head # Rubinius rbx-1.0.1 rbx-1.1.0 rbx-1.1.1 rbx-1.2.0 rbx-1.2.1 rbx-1.2.2 rbx-1.2.3 rbx[-head] # Ruby Enterprise Edition ree-1.8.6 ree[-1.8.7][-2011.03] ree-1.8.6-head ree-1.8.7-head # Kiji kiji # MagLev maglev[-25913] maglev-head # Mac OS X Snow Leopard Only macruby[-0.10] macruby-nightly macruby-head # IronRuby -- Not implemented yet. ironruby-0.9.3 ironruby-1.0-rc2 ironruby-headThis shows a list of all the versions of Ruby RVM is capable of installing. For the moment, I just want a standard installation of the latest Ruby version, which is Ruby 1.9.2:
$ rvm install 1.9.2 Installing Ruby from source to: /home/arsturges/.rvm/rubies/ruby-1.9.2-p180, this may take a while depending on your cpu(s)... ruby-1.9.2-p180 - #fetching ruby-1.9.2-p180 - #downloading ruby-1.9.2-p180, 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 8609k 100 8609k 0 0 828k 0 0:00:10 0:00:10 --:--:-- 1078k ruby-1.9.2-p180 - #extracting ruby-1.9.2-p180 to /home/arsturges/.rvm/src/ruby-1.9.2-p180 ruby-1.9.2-p180 - #extracted to /home/arsturges/.rvm/src/ruby-1.9.2-p180 Fetching yaml-0.1.3.tar.gz to /home/arsturges/.rvm/archives % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 455k 100 455k 0 0 586k 0 --:--:-- --:--:-- --:--:-- 730k --no-same-owner Configuring yaml in /home/arsturges/.rvm/src/yaml-0.1.3. Compiling yaml in /home/arsturges/.rvm/src/yaml-0.1.3. Installing yaml to /home/arsturges/.rvm/usr ruby-1.9.2-p180 - #configuring ruby-1.9.2-p180 - #compiling ruby-1.9.2-p180 - #installing Removing old Rubygems files... Installing rubygems dedicated to ruby-1.9.2-p180... Retrieving rubygems-1.6.2 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 236k 100 236k 0 0 1053k 0 --:--:-- --:--:-- --:--:-- 9025k Extracting rubygems-1.6.2 ... Installing rubygems for /home/arsturges/.rvm/rubies/ruby-1.9.2-p180/bin/ruby Installation of rubygems completed successfully. ruby-1.9.2-p180 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake). ruby-1.9.2-p180 - #importing default gemsets (/home/arsturges/.rvm/gemsets/) Install of ruby-1.9.2-p180 - #completeThis took about 10 minutes on this particular server. Now that it's done and installed, play around with it:
$ ruby -v ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2010.01 $ which ruby /usr/local/bin/ruby $ rvm use 1.9.2 Using /home/arsturges/.rvm/gems/ruby-1.9.2-p180 $ ruby -v ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux] $ which ruby ~/.rvm/rubies/ruby-1.9.2-p180/bin/rubyAs you can see, it's important to use the "rvm use" command to actually switch to a version of Ruby installed by RVM.
Conclusion
We followed the on-line RVM installation instructions on CentOS 5.6, first running the bash script, then following the instructions output by the script, including installing dependencies and adding one line to the .bashrc file. We did this without needing to upgrade git beyond what the CentOS default repositories offer.Summary of commands for power users
$ cat /etc/issue $ git --version $ bash --version $ bash < <(curl -sk https://rvm.beginrescueend.com/install/rvm) $ sudo yum install -y bash curl git ; sudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel ; sudo yum install -y make bzip2 ; yum install -y iconv-develNow place the following line in your .bashrc (but copy the one generated by your own installation, not mine):
[[ -s "/home/arsturges/.rvm/scripts/rvm" ]] && source "/home/arsturges/.rvm/scripts/rvm" # This loads RVM into a shell session.Next, make sure that there is no 'return' from inside the ~/.bashrc file.
Now restart the shell, and test the installation:
$ type rvm | head -1 rvm is a functionThis should return the phrase "rvm is a function".
$ rvm notes $ rvm list known $ rvm install 1.9.2Now try it out:
$ ruby -v ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2010.01 $ which ruby /usr/local/bin/ruby $ rvm use 1.9.2 Using /home/arsturges/.rvm/gems/ruby-1.9.2-p180 $ ruby -v ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux] $ which ruby ~/.rvm/rubies/ruby-1.9.2-p180/bin/rubyThank you to Wayne Seguin for RVM, and for all who contribute code, time, and money to open source software. Donate to RVM to show your support.
~fin~
It was of great help to me. Thanks so much!!. I will probably link this from my blog. Thanks again!
ReplyDeleteI'm trying to follow the step for the rvm installation script but seems that the URL is no longer available, is there another location you can recommend?
ReplyDelete