Install ruby ​​gems offline / proxy configuration

I need to install ruby ​​on rails + Nokogiri, httparty, json [and a few less significant stones] on a server that does not have an internet connection. How can I do that?

The host operating system is windows

An additional question, well, this is not very good for me, since it can take several days, but I can provide this server with access to the http proxy as a client. However, I must confess that I have already tried to use something like this

set http_proxy="http://username: password@host :port" 

or

 gem --http_proxy "http://username: password@host :port" 

but in both cases it was not possible to access the gem store :(

+4
source share
6 answers

I solved it like this:

 set http_proxy=host:port 

without quotes, http: // protocol and username: password. Greetings

+7
source

It helps me.

gem install -p http://proxy_ip:proxy_port rails

+6
source

Go to the page of the desired boot page to be installed. For example, I tried installing Sass, so I googled and reached sass 3.3.14 . Since I was behind my proxy server, I clicked the Download link and uploaded the gem to the directory.

Then, using the Ruby command line, change to the installed directory using pushd D:\Setups and use this:

 D:\Setups> gem install sass --local 

It is necessary to install the required stone.

+4
source

You can download all the jewelry you need (also dependencies) from rubygems to your server, then run gem install gem_name --local to install them.

+3
source

To use the proxy, Wolfbyte's answer worked for me. I work on Debian 7 (Wheezy).

How to upgrade Ruby Gems from behind a proxy server (ISA-NTLM)

I will also add his answer below:

I was not able to start my work from the command line, but I was able to do this simply by setting my HTTP_PROXY environment variable (note that this case seems important). I have a batch file with a line like this in it:

 SET HTTP_PROXY=http://%USER%:%PASSWORD%@%SERVER%:%PORT% 

I set four reference variables before I get this line, obviously. For example, if my username is wolfbyte, my password is secret, and my proxy is called pigsy and works on port 8080:

 SET HTTP_PROXY=http://wolfbyte: secret@pigsy :8080 

You might want to be careful how you handle this because it stores your password in text form in a machine session, but I don't think this should be too much of a problem.


In addition, there were funny characters in my password - the ones you have for URLEncode: http://www.cyberciti.biz/faq/unix-linux-export-variable-http_proxy-with-special-characters/

Hope this helps!

Colin

+3
source

Fast decision:

 gem install -p http://proxy_ip:proxy_port rails 

is fast and efficient, but I need something permanent for each installation.

Permanent decision:

  • Create a file:

     vi ~/.gemrc 
  • Add Content

     # HTTP Proxy options http_proxy: http://proxy_ip:proxy_port https_proxy: http://proxy_ip:proxy_port # For authentication (although not tested) http_proxy_user: username http_proxy_pass: password https_proxy_user: username https_proxy_pass: password 
  • Check proxies in gem environment variables

     gem env 

RubyGems environment: - RUBERS VERSION: 2.5.2 - RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [universal.x86_64-darwin17]

0
source

Source: https://habr.com/ru/post/1484798/


All Articles