Ask Your Question
0

install gem without internet connection

asked 2017-01-04 10:42:06 -0500

puser gravatar image

I have a sandbox server that I need to install some gems on, specifically rspec. How can I install this gem without doing a gem install command? Here is the github repo https://github.com/rodjek/rspec-puppet

gem install rspec ERROR: Could not find a valid gem 'rspec' (>= 0) in any repository ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) Errno::ECONNREFUSED: Connection refused - connect(2) (http://rubygems.org/latest_specs.4.8.gz)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-01-04 11:49:20 -0500

DarylW gravatar image

updated 2017-01-04 11:49:49 -0500

You will need to download all of the appropriate gems that you require, get them to your offline server (sneakernet), and then install them locally.

This first answer talks about the mechanics of installing a .gem file 'locally' instead of reaching out to a rubygem server

http://stackoverflow.com/a/11301073/3...

You can use bundler to create a 'package' of a gem and all of its dependencies on your connected machine, and then install that using gem install --local my_gem_bundle.gem

http://gembundler.com/v1.3/man/bundle...

http://stackoverflow.com/questions/43...

You also can run your own gem server, and reference that in your offline network. It still requires you to bring down the gems that you need, and load them into your server. http://www.jamesrobertson.eu/blog/201...

If you wish to install an individual gem using puppet, you can do something like the following for an offline setup.

You can use puppet's package type with the gem provider, and supply the 'source' gem file for installing gems. The problem is that it won't do any dependency resolution for you, you would have to order your installs manually yourself.

One thing that you may have to do (if you are not using the --local flag while trying to install your gems) is remove rubygems.org from your list of gem sources. gem sources -r https://rubygems.org/

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-01-04 10:42:06 -0500

Seen: 85 times

Last updated: Jan 04