4

I've installed Chef Server on Ubuntu 12.04 using the official instructions, which uses the "omnibus installer" that has embedded ruby 1.8.7.

I'm trying to install knife-windows, but when I run gem install knife-windows I get this error:

ERROR:  Error installing knife-windows:
        gssapi requires Ruby version >= 1.9.1.

I tried installing RVM and 1.9.3, but I got this error, and backed off:

/opt/vagrant_ruby/lib/ruby/site_ruby/1.8/rubygems.rb:900:in `report_activate_error': Could not find RubyGem chef (>= 0) (Gem::LoadError)
    from /opt/vagrant_ruby/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `activate'
    from /opt/vagrant_ruby/lib/ruby/site_ruby/1.8/rubygems.rb:1276:in `gem'
    from /opt/vagrant_ruby/bin/knife:18

What's the correct way to install Chef server & knife with Ruby 1.9.x?

2 Answers 2

3

It appears that the Chef Server is installed into a virtual machine created by Vagrant (/opt/vagrant_ruby). However, Chef Server 11+ is built on Erlang, not Ruby. It does come with Ruby, but you shouldn't use it directly. It's there for managing the Chef Server with chef-server-ctl.

The installation in the Vagrant box above probably puts the various Ruby binaries in the default $PATH, which means that using gem install will attempt to install the knife-windows gem into the Ruby placed there by Vagrant.

To further explain, the packages that Opscode provides for Chef and Chef Server include their own separate installation of Ruby. Opscode does this because the supported platforms for Chef and Chef Server all have different (outdated) versions of Ruby provided by default.

Day to day, most interaction with the Chef Server will be through the API using knife (or the webui). knife and its plugins should be used from a "workstation" system like a local laptop. If Chef is the only reason to have Ruby installed, then use the Ruby embedded in the Chef package, which should be installed on the local system. Installers are available for most major platforms, including Ubuntu, Windows, OS X, and others. Various development headers and build tools (gcc, make, etc) may be required depending on the plugins.

For what it's worth, the version of Ruby in the current "omnibus" package for Chef Server is not 1.8.7. It can be found at:

ubuntu@os-9348884648703137:~$ /opt/chef-server/embedded/bin/ruby --version
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]

(current version as of this writing)

The version of Ruby used in the Chef client package is generally updated more frequently, as the needs of client/workstation use move quicker than the Chef Server. The embedded version of Ruby in the Chef client package is:

% /opt/chef/embedded/bin/ruby --version
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-darwin11.2.0]

Opscode plans to update this version in the next release, so it may be different than what is shown for future visitors to this site. Also note that this came from a "local workstation" installation rather than the Chef Server.

2
  • The recommended installer for Ubuntu 12.04 did in fact come with Ruby 1.8.7. The installer for other Ubuntu versions may come with a different version. Jun 3, 2013 at 19:19
  • So, you're basically saying that I shouldn't use the "knife" command that comes with chef-server? I should use the chef-client version of knife instead? Jun 3, 2013 at 19:21
0

I would be uncomfortable using RVM for a 1.9.3 installation for a chef-server.

I would install 1.9.3 from, say, the Brightbox PPA (here are the detailed instructions, but it's basically adding that PPA and replacing 1.8 with 1.9, i.e., sudo apt-get install ruby1.9.3.

Once 1.9.3 and the associated RubyGem is in place, it should be sufficient to run gem install chef, so that chef-server is installed as a gem, rather than a deb package.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .