chef-infrachef-recipeberkshelfberksfile

Installing berks on centos


I am trying to install berks on centos using command:

[root@ip~]#gem install berkshelf --no-ri --no-rdoc 

After installing I have verified whether berks have been installed using the command:

[root@ip~]# berks -v
-bash: berks: command not found

Also I would like to tell you that I am using ruby that comes shipped with Chef. I have not installed ruby explicitly on system.

I would like to know how to install berks on centos.

Any lead in this regard would be highly appreciated.


Solution

  • CentOS probably has it's own system Ruby. When you run:

    $ which gem
    

    You will likely see:

    /bin/ruby
    

    or something similar. That is not Chef's Ruby. In order to use the gem command that is bundled in Chef's Ruby, you need to specify the full path:

    $ /opt/chef/embedded/bin/gem install berkshelf --no-ri --no-rdoc
    

    Then, the binstub is installed into Chef's Ruby, so running berks will not work directly. You need to specify the full path:

    $ /opt/chef/embedded/bin/berks -v
    

    Please also make sure the installation of Berkshelf completes successfully. If the gem (or one of its dependencies) fails to install, the binstub will not be present.

    You can avoid all this extra typing by adding /opt/chef/embedded/bin to your $PATH:

    # ~/.bashrc
    export PATH="/opt/chef/embedded/bin:$PATH"