Installing ruby on rails on RHEL 5.4 (x86_64) with ruby gems

Ben Reinhart's Avatar

Ben Reinhart

14 Jun, 2010 07:49 PM

I'm having issues getting the 'gem install rails' command to operate. I type the command, and nothing happens after like 5 minutes or more. Checking to see if rails or any components are there 'rails -v' still displays 'command not found'.

The computer currently has

ruby 1.8.8dev (2010-06-12) [x86_64-linux]

with rubygems at 1.3.6

It is a RedHat Enterprise Linux (5.4) distribution.

I have a couple ideas of what is wrong:
- the computer is not connected to the internet (I downloaded the ruby and gem tar files online onto another computer and remotely moved that file into the directory on the RHEL computer, then uncompiled them and installed). So when the gems are trying to install rails, i'm guessing that they are looking for something online (versions or something, maybe? not sure how gems operate).

  • possible clash with gem version and ruby version? seems very unlikely since there both fairly new versions

  • special directories for gems? ruby and the gems are in /usr/bin

Not sure what is going on here, please help..

Thanks in advance

  1. Support Staff 1 Posted by Eric Hodel on 14 Jun, 2010 07:54 PM

    Eric Hodel's Avatar

    Try running gem install -l rails (lowercase L) in the directory you have rails and its dependencies in. What is the output?

  2. 2 Posted by ben on 14 Jun, 2010 08:14 PM

    ben's Avatar

    Thanks a lot for the response...

    I typed that in in the directory I have RUBY in.. I do not have rails because the gem has yet to function and install it.

    [root@doss4100rh1 bin]# gem install -l rails ERROR: could not find gem rails locally or in a repository

    this is in the /usr/local/bin
    erb gem irb rdoc ri ruby testrb


  3. Support Staff 3 Posted by Eric Hodel on 14 Jun, 2010 08:40 PM

    Eric Hodel's Avatar

    No, the directory where you've put the rails gem and it's dependencies:

    $ ls rails* rails-2.3.8.gem
    $ gem install -l rails -i gems ERROR: Error installing rails:

    rails requires rake (>= 0.8.3, runtime)

    (I didn't download any dependencies)

  4. 4 Posted by ben on 14 Jun, 2010 08:56 PM

    ben's Avatar

    Once again, thanks for the response!

    Alright I now know what the issue is. The RHEL computer that I am doing a remote installation of ruby on rails is not connected to the internet. The rubygems points it's repository to What I need to do is download the gems associated with rails installation into a file then create a local file on the RHEL machine and put those gems into that file. Then I need to change rubygem's default repository to point to the local repository.

    I'm not sure which gems need to be in the repository for a nice clean ruby on rails installation.


  5. 5 Posted by ben on 14 Jun, 2010 09:15 PM

    ben's Avatar

    In otherwords, what other gems besides rails do I need to have a fully functional ruby on rails setup? Do I need any other gems? Installing mongrel?

    Also, where is the file(s) that point the repository to Is it in lib/ruby/rubygems/defaults.rb? I see this in there:

    def self.default_sources



    Is that all I need to change in order to point to a local repository?

    If so (my apologies, major noob here), would I do %w[lib/rubygems/local_gem_repository] or something like that? I am not sure what the %w means.


  6. Support Staff 6 Posted by Eric Hodel on 14 Jun, 2010 10:03 PM

    Eric Hodel's Avatar

    The easiest way to determine this is to run:

    gem install -i gems rails --no-rdoc --no-ri on a machine with internet connectivity then copy gems/cache/* to the internet-less machine.

    There's no need to set up a repository, RubyGems knows how to install from .gem files on disk.

  7. 7 Posted by ben on 14 Jun, 2010 10:27 PM

    ben's Avatar

    Thanks, I'll see what I can do but I do not think I have privileges to install ruby and rubygems on my current station, which is a windows computer anywho.

    But anyways, where is gems/cache I cannot find that file, I looked in the rubygems directory and could not find it.

    and if I do not need to create a local repository, then (since i've already downloaded the rails gem) can't I just move the rails gem somewhere into the rubygems directory and then do a gem install rails?

    If so, where do I put the rails gem file?


  8. Support Staff 8 Posted by Eric Hodel on 14 Jun, 2010 10:49 PM

    Eric Hodel's Avatar

    gems/cache will only exist after you run gem install -i gems. Otherwise you can trace through the dependencies starting here by hand:

    See comment 4 for how to install from a .gem file.

  9. 9 Posted by ben on 15 Jun, 2010 02:21 PM

    ben's Avatar

    Sorry, one last question I swear.. Where do the .gem files go? I have /usr/local/lib
    which has:
    gauntlet_rubygems.rb rbconfig rubygems ubygems.rb
    libruby-static.a ruby rubygems.rb

    inside rubygems i have lots of .rb files and folders 'commands', 'ext' and 'package'
    inside ruby i have:
    1.8 gem gems site_ruby vendor_ruby
    which are all folders.

    inside gem and gems i basically have the same thing that is in the rubygems directory above.

    Also, when I put those gem files in some local folder next to gems, when I do a 'gem install..' won't it still look to for the gems? So don't I still have to change something so that it knows where to look for the gems? If so what?

    Thanks so much!

  10. Support Staff 10 Posted by Eric Hodel on 15 Jun, 2010 06:26 PM

    Eric Hodel's Avatar

    You have to install the gems (the .gem files) using gem install -l (lowercase L).

    Place them in any convenient directory that's NOT one of the ones you've listed.

  11. 11 Posted by ben on 15 Jun, 2010 08:02 PM

    ben's Avatar

    I am having a new problem all together.

    All the necessary gems are downloaded and are in the directory /opt
    this is where we moved the downloaded ruby file (later used to install ruby) and the downloaded rubygems file (used to successfully install rubygems-1.3.6).

    the installed rubygems1.3.6 is in /usr/local/lib/rubygems

    I am receiving a new error when I try to install rails
    if i type ' gem install rails ' I get this error:
    [root@doss4100rh1 gems]# gem install rails ERROR: does not appear to be a repository
    ERROR: could not find gem rails locally or in a repository

    before it never said 'could not find gem rails locally or in a repository'

    if I type 'gem install -l rails -i gems' I get this error:
    [root@doss4100rh1 opt]# gem install -l rails -i gems ERROR: Error installing rails:

        actionpack requires rack (~> 1.1.0, runtime)

    I noticed that in /usr/local/lib/rubygems/commands there is a file sources_command.rb and with this you can add a source, but that source must be a URI... not a directory.
    Is there anyway I can get rails to know where to look for these gems, what other directories can I put these gems into?

    I could put them on a localhost server and add a source pointing to the localhost URI... but this causes problems too because I do not have rails installed on this windows computer and do not have permissions to do so. Unless there is a way to start up a server with just ruby, which is installed on the machine that I am trying to get rails onto, then I'm pretty much stuck on this as well.

    Any other ideas of where to put these .gem files or anything, I've been playing around with it a little so far, not luck yet.

    Thanks so much!

  12. Support Staff 12 Posted by Eric Hodel on 15 Jun, 2010 08:36 PM

    Eric Hodel's Avatar

    What gems are in /opt? ls /opt

    You should not install with -i on this machine, that was only for gathering the proper gems, it will not do what you want. Just gem install -l rails.

  13. 13 Posted by ben on 15 Jun, 2010 09:26 PM

    ben's Avatar

    New problem again (by the way, I really appreciate you hanging in there with me, thanks a lot)

    Rails is finally installed, I installed with that command when inside the /opt directory, but first I had to install rack-1.1.0 .

    This is great, I created the an application. Although I know I'm missing the sqlite gem. But my fear is that I'm missing a lot more gems. When I looked at the rails gem dependencies on this site it gave me the 5 or so dependencies that are shown in the paragraph below. When I looked on my computer from home, there are many many more gems. But I only wnat the ones I need.

    inside /opt , where all the gems I installed are, if I do ' ls '
    actionmailer-2.3.8.gem rubygems-1.3.6 #folder
    actionpack-2.3.8.gem rubygems-1.3.6.tgz
    activerecord-2.3.8.gem stable-snapshot.tar.gz
    activeresource-2.3.8.gem rack-1.1.0.gem
    activesupport-2.3.8.gem rails-2.3.8.gem
    gems #folder rake-0.8.7.gem
    Hello_World#rails_application ruby #folder

    Other than this list, and the database gem, are there any others..
    ohh and mongrel I want to get that too.

    But other than those, any others that will be necessarily for clean and smooth development?

  14. Support Staff 14 Posted by Eric Hodel on 15 Jun, 2010 09:42 PM

    Eric Hodel's Avatar

    I don't know what other gems would be good for clean and smooth development for you. You should ask on a Rails-specific help forum like the #ror channel on freenode.

  15. 15 Posted by ben on 15 Jun, 2010 09:46 PM

    ben's Avatar

    Alright well at least I got pretty much everything I need, thanks a lot for the help!!!!!

  16. Eric Hodel closed this discussion on 15 Jun, 2010 09:53 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac