Can we install chef client in custom location in linux?


Hi ,
The default installation of chef-client happens in /opt directory. I have a requirement where i need to install chef client under /usr/local/custom directory.
I did below trails.
Trail 1:
rpm -i --prefix=/usr/local/custom chef-13.8.5-1.el7.x86_64.rpm
From that I am able to install the chef client with directory path as i expected. But while trying to run chef client command, i got an error, that is:
bash: ./chef-client: /opt/chef/embedded/bin/ruby: bad interpreter.
Trail 2:
I have downloaded the chef client version . Installed it on my test box, after that i created a tar.gz file with the directory structure under /rpmbuild/SOURCES/
Later I tried to create my own RPM SPEC file as per my requirement under /rpmbuild/SPECS/ and ran the rpmbuil. And created my own rpm.
rpm -ivh pdit-1-0.x86_64.rpm
error: Failed dependencies:
/opt/chef/embedded/bin/ruby is needed by pdit-1-0.x86_64
perl(WWW::Curl::Easy) is needed by pdit-1-0.x86_64
Later I tried with the option “rpm –ivh pdit-1-0.x86_64.rpm –nodeps” . From that I am able to install the chef client with directory path as i expected .
But while trying to run chef client command, I got an error, that is: “bash: ./chef-client: /opt/chef/embedded/bin/ruby: bad interpreter:”

Can some please help me on this.
Can we run 2 Chef instances in parallel in one system?
Thank you


In parallel? Unlikely. Simply duplicating the code somewhere else is not going to correctly segregate temporary files in download locations, nor update the references to binaries stored in shell scripts, nor segregate working files compiled by the running chef client.

Why do you want to do simultaneous runs?


Thank for the replay.
I have to build my custom chef RPM that does not get installed in default path. The reason being there are several servers out there that will have default chef client (is in /opt) used for some purpose… we could not uninstall the older version because the recipes were tested with older version are in production environment.
I want to install new release chef client version which is compatible with my newly written cookbooks in custom location and those will monitoring purpose of the system.


I think this is a dangerous approach. Running two distinct chef versions at the same time on the same host is asking for pain. If you need the older chef for compatibility, why do you need the new chef as well?