RVM - is there a way for simple offline install?

2019-05-13 21:53发布

问题:

I would like to install RVM in an offline machine - I can manually transfer any file needed, but it'll be impossible to have an internet connection. Not being online causes RVM to collapse when trying to download source files for ruby or other dependencies (zlib, etc).

I'm looking for a way to point RVM to the location of ruby source folder, e.g. something like rvm install 1.8.7 --source=/path/to/ruby-1.8.7-p330/, or any other dependencies. I've scoured the rvm docs but either missed something or it's not there. Any other suggestions as to how to accomplish this installation are also welcome. thanks.

回答1:

When rvm downloads a version of ruby it saves it to .rvm/archives. So you can drop the .tar.bz2 source of ruby into that directory and rvm will use that instead of trying to download it:

cp ruby-1.8.7-p330.tar.bz2 ~/.rvm/archives/
rvm install ruby-1.8.7


回答2:

set up a second machine (source) with identical user account, and use that machine to install RVM, to install Ruby and all the Gems you need...

Then, once you have installed all the things you need, use rsync to copy the complete ~/.rvm directory from your source machine to your offline machine. rsync is your friend!

If you don't have an internet connection on the offline machine, use a flash drive, and copy everything with 'cp -rp' to the flash drive -- then onto the offline machine.

Note: the name of the user account has to be the same on both machines!

If you don't use the same user names, you will run into some weird error messages later... RVM memorizes the complete path where a gem or ruby version was installed -- it doesn't use the $HOME variable. If you use the same user account on all machines for deployment, you won't see those errors.



回答3:

Maybe it is not the simplest but RVM provides documentation for the offline installation: http://rvm.io/rvm/offline - it also includes information how to deploy your application offline.



回答4:

Also need help with this, and I'm too poor to comment.

None of the above solutions work. The RVM-offline doc doesn't help at all. No matter what I do, it wants to install from source, which is not helping.

How do I hint or force RVM to use the global archives directory?

Maybe the question is: once the ruby tree is in place, how to tell RVM that it's there and can be used?

Found the answer.

Put the binary in the archives directory, as suggested by the rvm site, then mount it.:

cp rvm-binary-2.x.x-pyyy.tar.bz2 /usr/local/rvm/archives/ # or whichever
rvm mount -r /usr/local/rvm/archives/rvm-binary-2.x.x-pyyy.tar.bz2

Now you might get output like this:

/usr/local/rvm/archives/bin-ruby-2.0.0-p598.tar.bz2 - #configure
ruby-2.0.0-p598 - #download
ruby-2.0.0-p598 - #validate archive
ruby-2.0.0-p598 - #extract
ruby-2.0.0-p598 - #validate binary
Libraries missing for ruby-2.0.0-p598: libyaml-0.so.2. Refer to your system manual for installing libraries

showing that you are on the right track. After installing yaml, I redo the rvm mount -r op and get:

/usr/local/rvm/archives/bin-ruby-2.0.0-p598.tar.bz2 - #configure
ruby-2.0.0-p598 - #download
ruby-2.0.0-p598 - #validate archive
ruby-2.0.0-p598 - #extract
ruby-2.0.0-p598 - #validate binary
ruby-2.0.0-p598 - #setup
ruby-2.0.0-p598 - #gemset created /usr/local/rvm/gems/ruby-2.0.0-p598@global
ruby-2.0.0-p598 - #importing gemset /usr/local/rvm/gemsets/global.gems..............................
ruby-2.0.0-p598 - #generating global wrappers........
ruby-2.0.0-p598 - #gemset created /usr/local/rvm/gems/ruby-2.0.0-p598
ruby-2.0.0-p598 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.0.0-p598 - #generating default wrappers........

After which I verify: rvm use 2.0.0-p598

And we're good to go.