How to install vagrant plugin on Windows 7 without internet connection? - ruby

I'm trying to install vagrant-hostmanager plugin on Windows 7 without internet connection.
I have downloaded gem file from rubygems.org and copied to this machine to D:\distr\Vagrant.
Then I move to this folder and run in Command Prompt with Ruby (with Administrator privilegies):
vagrant plugin install vagrant-hostmanager --entry-point vagrant-hostmanager-1.8.6.gem
And get the following error:
Installing the 'vagrant-hostmanager' plugin. This can take a few minutes...
Vagrant failed to load a configured plugin source. This can be caused
by a variety of issues including: transient connectivity issues, proxy
filtering rejecting access to a configured plugin source, or a configured
plugin source not responding correctly. Please review the error message
below to help resolve the issue:
Errno::ECONNREFUSED: No connection could be made because the target machine ac
tively refused it. - connect(2) for "api.rubygems.org" port 443 (https://api.rub
ygems.org/specs.4.8.gz)
Source: https://rubygems.org/
I put specs.4.8.gz to his folder too but it didn't help. I also put specs.4.8 to SPEC CACHE DIRECTORY and gem file to GEM PATHS defined in gem environment. It also didn't help.
Versions:
Windows Enterprise Service Pack 1 (32 bit)
vagrant_1.9.5.msi
VirtualBox-5.1.22-115126-Win.exe
rubygems 2.5.2
rubyinstaller 2.3.3 (2016-11-21 patchlevel 222) [i386-mingw32]
I also tried with another versions of vagrant and gem: vagrant_1.8.4.msi and vagrant-hostmanager-1.8.5.gem. Result is the same.
Is it possible to install vagrant plugin offline?
Thanks!

Related

How to run Vagrant on Windows with Ruby and Rack

I'm trying to run a VM with Vagrant on Windows 10. Vagrant installed fine. I tried to run vagrant up --provision and always got
The plugins failed to load properly. The error message given is
shown below.
cannot load such file -- rack
This seems like a Ruby problem, so I installed Ruby and Rack. But Ruby is only recognized on my home directory, not the directory of the application.
Could be that your local Ruby installation is missing Rack:
gem install rack

Unable to install bundler/gems after upgrading jruby and rubymine version (SSLError)

So recently I was encountering some SSL cert issues so in order to help fix that, I've upgraded our jruby 1.7.4 to jruby 9.1.15 and our RubyMine to 2018.2.1 (team using Ruby Cucumber).
However, now we're facing an issue installing /updating gems and bundler after the upgrade.
We're trying to install from the command prompt:
$ set HTTP_PROXY=https://username:password#proxyurl.net:port
$ gem install bundler
And receiving the error:
ERROR: While executing gem ... (OpenSSL::SSL::SSLError)
Received fatal alert: protocol_version
Before setting the proxy the error was:
WARNING: Unable to pull data from 'https://rubygems.org/':
SocketError: Failed to open TCP connection to rubygems.org:443
(initialize: name or service not known)
(https://rubygems.org/specs.4.8.gz)
1 gem installed
I've even tried going to a Starbucks to avoid the proxy altogether but am still getting a similar error.
Just to add in trying to install bundler in RubyMine itself doesn't work.
So somehow I fixed it.. I'm not able to reproduce the fix but that might be related to some foundation problems the fix caused.
Basic steps I used (any of these might help):
Removed versions from gemfile
Trying to install bundler from outside proxy
Install bundler through command prompt and install gems through RubyMine
Change gemfile source to 'http' instead of 'https'
Will update more if I find how to reproduce fix

Vagrant plugins fail with "uninitialized constant Rails"

I downloaded and installed Vagrant 2.0.2 on my Mac, successfully provisioned a new virtual machine, however I am not able to share it via vagrant share, due to the following error:
Vagrant failed to initialize at a very early stage:
The plugins failed to load properly. The error message given is
shown below.
uninitialized constant Rails
I tried installing Ruby on Rails, thought that vagrant might need it, still get the same error.
I tried with another plugin, the login one, and got the same error message, so it seems that the problem is related to the plugins.
Here's the list of plugins I currently have installed:
$ vagrant plugin list
login (0.1.1)
- Version Constraint: > 0
share (1.0.1)
- Version Constraint: > 0
$ vagrant -v
Vagrant 2.0.2
I encountered a similar issue after upgrading, specifically as a result of the share plugin.
vagrant login is part of Vagrant core as of 1.7.0 so you shouldn't need it installed as a plugin.
vagrant share was silently removed in 2.0.2 (see https://github.com/hashicorp/vagrant/issues/9485) but it can still be installed manually as vagrant-share.
The following commands should fix your issue:
vagrant plugin uninstall login
vagrant plugin uninstall share
vagrant plugin install vagrant-share
Also note that per docs Vagrant Share via Atlas has been deprecated and it now requires ngrok.
https://www.vagrantup.com/docs/vagrant-cloud/vagrant-cloud-migration.html#vagrant-share
https://www.vagrantup.com/docs/share/

failed to install vagrant-cachier plugin on windows

I am new to vagrant.
I have installed virtualbox and vagrant(1.7.4) and then follow the book type
$> vagrant plugin install vagrant-cachier
After some minutes,it reported an error:
> vagrant plugin install vagrant-cachier
Installing the 'vagrant-cachier' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:
An error occurred while installing childprocess (0.5.7), and Bundler cannot continue.
Make sure that `gem install childprocess -v '0.5.7'` succeeds before bundling.
Warning: this Gemfile contains multiple primary sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. To upgrade this warning to an error, run `bundle config disable_multisource true`.Gem::RemoteFetcher::FetchError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server session ticket A (https://rubygems.org/gems/childprocess-0.5.7.gem)
I know little about ruby and gem.Is there anything else need to be installed before install plugins?
Or maybe the network issue? (I tried at home and office,the same error)
vagrant works fine that I can init, up and ssh normally.
I ran into the same issue finding it is a matter of gems folder misconfiguration.
I solved it with the following steps:
check where are your gems inside your vagrant installation (e.g. %vagrant_home%/embedded/gems/gems)
check your gem configuration with the command gem environment and looking for the section named GEM PATHS (if gem is not in you path look for it under the vagrant installation folder, e.g. %vagrant_home%/embedded/bin)
if the path at point 1 is not present within the section at point 2, include it with the command export GEM_HOME=/path/to/gems/folder (e.g. export GEM_HOME=%vagrant_home%/embedded/gems/gems)
P.S. %vagrant_home% refers to the vagrant installation base folder, use set instead of export under windows ...and sorry if I mixed unix and windows syntaxes
Test Environment: Vagrant 1.8.1 (gem 2.4.5.1) on Windows 7 behind web proxy
I installed this plugin https://github.com/winnfsd/vagrant-winnfsd and now Vagrant Cachier works like a charm on Windows 10.
To run it on Ubuntu simply install the nfs-server
https://stackoverflow.com/a/52361432/1679541

gem install XYZ locally (without connection to the internet)

I need to install win32-api and antlr3 on a computer without internet connection. Had it such a connection, I'd use gem like so:
gem install win32-api -r
gem install antlr3 -r
This won't obviously work. So, I thought there should be a way to download the gem and install it later, but I am not sure how I would proceed.
I found gem's which operator, which seemd to indicate the local location of a gem:
c:\>gem which antlr3
c:/tools/Ruby187/lib/ruby/gems/1.8/gems/antlr3-1.8.8/lib/antlr3.rb
however, it didn't work on win32-api:
c:\>gem which win32-api
ERROR: Can't find ruby library file or shared library win32-api
although I have previously installed it.
Can someone hint at the right direction to go on from here?
Try,
gem install --local path/to/file.gem
I had some problems with this on a VM. The VM intentionally did not have Internet access (sneaker-net test machine) but it still had some DNS servers configured.
For example:
$ gem install bundler-1.7.7.gem --local
ERROR: While executing gem ... (Errno::ENETUNREACH)
Network is unreachable - sendto(2) for "192.168.1.10" port 53
192.168.1.10 is the DNS server that VirtualBox configured. So what I had to do is comment out /etc/resolv.conf with ; at the beginning of all the lines. Even leaving in Google DNS would break it.
; /etc/resolv.conf
nameserver 8.8.8.8 ; nope. gem install --local doesn't like it
; You will get a Network is unreachable - sendto(2) for "8.8.8.8" port 53
If you comment out all of /etc/resolv.conf then you can install gems locally (from a file) it seems.
$ gem install bundler-1.7.7.gem --local
Successfully installed bundler-1.7.7
Parsing documentation for bundler-1.7.7
Installing ri documentation for bundler-1.7.7
Done installing documentation for bundler after 4 seconds
WARNING: Unable to pull data from 'https://rubygems.org/': no such name (https://rubygems.org/specs.4.8.gz)
1 gem installed
Ruby gems version: 2.4.4 on Ruby 2.1.5.
gem will first look in the current directory after .gem files. Try downloading the .gem files of the gems you want to install on a computer with an internet connection (and don't forget dependencies), then move the files over to the other computer and run gem install xyz in the same directory where you placed the .gem files.

Resources