corroded
corroded

Reputation: 21584

install RVM offline completely

I am planning to create an installer for a ruby script but I want to be able to ensure that the machine has RVM installed. Is there a way to install RVM completely offline and unobtrusive as well(by unobtrusive, as in create a script that can do everything instead of ask users to add something to their bash_profile or bashrc)

I am not asking for the script itself, just a quick pointer as to how to go about this route(if it is even possible). We have also looked into this question which was helpful enough:

RVM - is there a way for simple offline install?

but a bit misleading as the answer only shows us how to install a ruby in RVM offline. We need to be able to install RVM itself offline, and looking at the script

https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer

do I just include this whole script and change the rvm_releases_url into something else? And is it safe to just append the rvm path to a user's bash_profile, or bashrc instead of asking them to do it?

Upvotes: 5

Views: 5943

Answers (3)

As per the suggestion given editing this comment. :-)

Installing RVM offline :

- Download the rvm tarball: 

            curl -sSL https://github.com/rvm/rvm/tarball/stable -o rvm-stable.tar.gz

- Create and enter rvm directory: 

            mkdir rvm && cd rvm 

- Unpack the tar file : 

            tar --strip-components=1 -xzf ../rvm-stable.tar.gz

- Install rvm: 

            ./install --auto-dotfiles

            use --help to get the options

- Load rvm: 

            source ~/.rvm/scripts/rvm

Download Ruby, rubygems and yaml :

- Download ruby

    o Find tar.bz2 version at: 

            https://ftp.ruby-lang.org/pub/ruby/ (check sub-directories)

    o Download with curl: :

            curl -sSL https://ftp.ruby-lang.org/pub/ruby/ruby-2.2.0.tar.bz2 -o ruby-2.2.0.tar.bz2

    o Make sure you are downloading with the extension " .tar.bz2 "

- Download rubygems

    o Find version at:

            https://github.com/rubygems/rubygems/tags
    o Download with curl:

            curl -sSL http://production.cf.rubygems.org/rubygems/rubygems-2.4.6.tgz -o rubygems-2.4.6.tgz

Install dependencies :

- Disable automatic dependencies ("requirements") fetching using the following command.

             rvm autolibs read-fail

- Manually download and install dependencies

    o Get the list of dependencies using

             rvm requirements

Installing Ruby :

Clean default gems:

            echo "" > ~/.rvm/gemsets/default.gems

Clean global gems:

            echo "" > ~/.rvm/gemsets/global.gems

Install Ruby:

            rvm install 2.2.0 --rubygems 2.4.6 (this may require sudo password for autolibs)

Install any other Ruby versions you want similarly

Set default Ruby version: rvm use 2.2.0 --default

NOTE : The ruby and other packages should be placed in the " $rvm_path/archives/ " directory.

Installing gems :

    There are multiple ways to install gems, we can download the gem files,
    but the best way seems to be Bundler: http://bundler.io/bundle_package.html

Example installing rails gem:

    Offline
    --------

        Create a directory:

                    mkdir gems; cd gems

        Unpack gems:
                    tar xzf gems.tgz

        Install bundler:

                    gem install bundler-1.8.3.gem

                    [ This needs internet, to avoid internet connection you need to install bundler gem using --local option with the bundler.x.x.gem file ]

        Install gems:

                    bundle install --local

UNINSTALL rvm :

    rvm implode --force

    Then remove rvm from following locations:

    rm -rf /usr/local/rvm
    sudo rm /etc/profile.d/rvm.sh
    sudo rm /etc/rvmrc
    sudo rm ~/.rvmrc

    Check the following files and remove or comment out references to rvm

    ~/.bashrc
    ~/.bash_profile
    ~/.profile
    ~/.zshrc
    ~/.zlogin

    Comment-out / Remove the following lines from /etc/profile

     source /etc/profile.d/sm.sh
     source /etc/profile.d/rvm.sh

    /etc/profile is a readonly file so use

    sudo vim /etc/profile

You can find the installation method here also...

Reference : https://github.com/rvm/rvm-site/blob/master/content/rvm/offline.md

Upvotes: 4

holms
holms

Reputation: 9580

Update: Finally finally finally!!! We have it!

https://rvm.io/rvm/offline/

Full instructions for offline installation!

Upvotes: 3

mpapis
mpapis

Reputation: 53178

It should be enough to get copy of the sources and run:

./install

in the root of it,

for installing ruby you will need to get archives of ruby and rubygems to rvm/archives and set rubygems_version=1.8.24 in rvm/user/db

There is also another project I'm involved that will embed RVM and allow offline installation: https://github.com/railsinstaller/railsinstaller-nix

Upvotes: 2

Related Questions