Failed to configure an environment for GSWD lessons - ruby

I want to configure an evirinment to take Django lessons from enter link description here
The main problem that I'm getting errors with instalation of some Ruby gems.
At first I've got an error that told that mixlib is not installed because it requires ruby 1.9.3.
So, I've changed 11th string of the postinstall.sh file like this
The version of Ruby to be installed supporting the Chef and Puppet gems
ruby_ver="1.9.3-p429"
So then I've rerun postinstall.sh script. But I've got an error
ERROR: Error installing chef:
ohai requires Ruby version >= 2.0.0.
To fix that I've installed Ruby 2.1 and set it to use by default, then installed chef.
After I've logoff, run vagrant ssh, typed the pass. The inputed ls and there weren't synced files from host machine. I've run sudo ./postinstall.sh again and got the ohai version error.
Is there any ideas how to fix it?

That example is badly out of date with the following list of problems:
Chef is now installed using an omnibus package which contains an
embedded ruby. No more mucking around with gem installs.
Vagrant now supports a chef zero provisioner, big improvement over chef-solo and will also install chef.
Old format Vagrantfile. V2 has introduced a number of incompatible changes.
That example uses Ubuntu 12.04 which is no longer supported.
The "aws" cookbook under the "cookbooks" directory has invalid metadata causing chef to fail.... In fact all the cookbooks look out of date.
==> default: [2015-04-11T20:04:06+00:00] ERROR: Cookbook loaded at path(s) [/tmp/vagrant-chef/046103d02209a201a2d21ece6c21437c/cookbooks/aws] has invalid metadata: The `name' attribute is required in cookbook metadata
Tutorial needs a substantial re-write, sorry. (If the code was in github that might encourage others to help refactor it)

Related

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

How to handle different ruby version requirements between chef 10.28.0 and ohai 8.0.1

I'm trying to build a server on rackspace using chef 10.28.0, building the exact same configuration that I've built three times before without any changes. The only difference is that chef installed ohai 7.4.0 on the previous runs and this time it is installing ohai 8.0.1.
The problem is that chef 10.28.0 installs ruby 1.9.3, whereas ohai 8.0.1 requires ruby 2.0.0 or greater. From my googling I have found that chef 10 supports ruby 2.0 but installs ruby 1.9 by default. Is there any way to get chef 10 to install ruby 2.0 instead? Barring that, is there any way to get chef 10 to install ohai 7.4 instead of 8.0?
Thanks in advance.
Please use the omnibus installer packages. These include Ruby, Chef, Ohai, and all the other dependencies in a working configuration. You can download older versions of the omnibus installers from the download page:
Or you can use the -v option to the bootstrap scripts.
The answer was in the bootstrap scripts. We are using custom bootstrap scripts and the versions for ruby, chef and ohai are all in there.

Is it possible to install and use a Ruby distribution alongside a PC with Opscode Chef Client without one affecting the other?

I'm running chef-client on Windows, and as it happens, the Ruby distribution (1.9.3) embedded in Chef-Client is available system-wide. I believe this is necessary in order to have chef-client function properly? I have tried installing another Ruby distribution (namely, v2.0) but that seems to break Chef-Client.
What I was hoping to achieve is to have chef-client install & configure a Ruby app written against v2.0, so that I can run that app with v2 but have chef-client continue to use the embedded Ruby distribution.
Would that not be possible?
Sure, that's why Opscode is using their Omnibus packages, which ships everything required to run Chef.
Use the "gem_binary" attribute to specify the ruby distro:
gem_package "somegem" do
gem_binary "/usr/bin/gem"
action :install
end
The documentation describe the parameter as follows:
gem_binary: An attribute for the gem_package provider that is used to specify a gems binary. This attribute is useful when installing Ruby 1.9 gems while running in Ruby 1.8. By default, the same version of Ruby that is used by the chef-client will be installed.

Path to gem (e.g. /var/lib/gems/1.8/bin/) when Ruby is installed using RVM?

First-time Ruby user here, and Jekyll is the reason.
First, I installed RVM (on Ubuntu Server 12.04 64-bit):
\curl -L https://get.rvm.io | bash -s stable
And followed the subsequent instructions as guided by the installation process (for e.g. adding source ~/.profile to ~/.bash_profile). The FULL INSTRUCTIONS I followed are here.
Read output of rvm requirements command, and installed all the necessary binaries.
Installed Ruby 1.9.3, configured RVM to use it, and then installed RubyGems, by issuing the following command one after the other:
rvm install 1.9.3
rvm use 1.9.3
rvm rubygems current
Ran ruby --version to be sure I'm using Ruby 1.9.3.
Then installed Jekyll using the gem:
gem install jekyll
Setup the basic site structure by copying the contents of jekyll/site provided by the official Jekyll repository, then made the necessary changes to _config.yml and CNAME.
Here's the thing! When I run jekyll --server I get the same old TCP/Webrick error (but none of the solutions work).
So, as the Jekyll wiki says, it's probably this:
On Debian or Ubuntu, you may need to add /var/lib/gems/1.8/bin/ to your path.
The problem is:
In my case, /var/lib/gems/... doesn't exist. Probably because I installed Ruby, RubyGems, all using RVM. So, what'd be the path in my case?
Again, if I know the path, how am I supposed to "to add /var/lib/gems/*.*/bin/ to your path"?
First of all, you can just ignore this problem, if you mean
[2012-04-21 13:46:40] WARN TCPServer Error: Address already in use - bind(2)
It's because some buggy code in latest version of jekyll on RubyGems, however, it seems to have been corrected in the latest code on github. The server created by jekyll tries to bind on both IPv4('0.0.0.0') and IPv6('::'), so the first bind succeeds and the bind on IPv6 fails and an warning is logged.
Take a look at the jekyll executable in your ~/.rvm directory, maybe ~/.rvm/gems/ruby-1.9.3-p392/gems/jekyll-0.12.1/bin/jekyll, at about line 288:
s = HTTPServer.new(
:Port => options['server_port'],
:MimeTypes => mime_types
)
Here HTTPServer is WEBrick::HTTPServer. jekyll creates the server without specifying :BindAddress configuration. And the bind address is set to nil as default.
WEBrick will call Socket.getaddrinfo to get the real addresses from the bind address specified, which, when passed in a nil address, returns wildcard address for both IPv4('0.0.0.0') and IPv6('::'). Later, WEBrick calls TCPServer.new(address, port) to create TCPServer. And this is where the TCPServer Error arises.
For more details, read WEBrick::Utils.create_listeners

Resources