Installing chef-client in a custom location

Hello team,

We want to do a chef-client installation in a custom location .The reasons are thus
1.We get by default chef-client 11.12 version installed in the standard /opt location when the VMs are created
2.We want to install chef-client 12.6 in another new location for the purpose of testing out some new features of chef and possibly going into production with it .
3.We do not want to uninstall the earlier chef-client because we think there may be recipes that have made some assumptions on libraries of older version of chef.

In short our understanding was that as chef packages its own version of ruby ,it will not interfere with the other chef-client on same machine .But it turns out ruby references statically linked libraries to /opt/chef

Is there a way to do this and has anybody done it ,to have 2 versions of chef on same machine ?

Just out of curiousity, what is stopping you guys from just trying with the updating version, and then simply reinstalling the older version if things don’t work out? Seems like you’re overthinking the problem.

Unfortunately there is no “official” way to do this as the Omnibus-based installers are all built against /opt/chef as you noted. Your best bet is probably to install the older version via bundler, but down this path lies many dragons, hence why the installers exist in the first place.

Thanks for the responses .We couldnt uninstall the older version as there were recipes outside our control that would run on the same . We wanted to use the new version because we believe we can leverage those recipes that are in our control
to make use of some features of chef 12.1 (We are particularly interested in the socket-less mode support)

As there seems to be no way for now,we will continue to use the older version until everyone can cut over.

There’s not that much that did break between 11 and 12, I think we had to update/tweak 6 or 7 cookbooks over 90 here for really minor changes.

As you’re talking about VM, you should be able to get a test run, get a new VM, add the omnibus_installer in the run list and test the cookbooks you don’t own against the new chef-client version.
If it fails you’ll know quickly what and you’ll be sure of why you stay on an older version, or you’ll have an idea of what to do to update the “legacy” version of your VMs.

Hi Sumant,
I have the same requirement. Does your issue fixed? Are you able to run chef client in your custom location ?
I have created my own chef client RPM with SPEC file in custom location.
But while trying to run chef client command, I got an error, that is: “bash: ./chef-client: /opt/chef/embedded/bin/ruby: bad interpreter:”
Thank you.
Vara.