sudhakar k
sudhakar k

Reputation: 11

getting an error while generating a cookbook using chef generate cookbook

I am new to chef and learning.I am getting the below error while generating the cook book.i followed the below steps .Please let me know the further steps to proceed.

root@ip-IPAddress:/home/ubuntu/chef-repo/cookbooks# chef generate cookbook webserver
Command 'chef' is available in '/usr/games/chef'
The command could not be located because '/usr/games' is not included in the PATH environment variable.
chef: command not found

for that as per the suggestion i added this.

root@ip-172-31-7-14:/home/ubuntu/chef-repo/cookbooks# export PATH="/usr/games:$PATH"
root@ip-172-31-7-14:/home/ubuntu/chef-repo/cookbooks# chef generate cookbook webserver
Can't open generate: No such file or directory.
Can't open cookbook: No such file or directory.
Can't open webserver: No such file or directory.

Upvotes: 1

Views: 1763

Answers (1)

McGrady
McGrady

Reputation: 11477

It seems your operating system is Ubuntu, I tried to install chef on my ubuntu VPS by following steps, it works well:

  1. Download the Chef development kit: https://downloads.chef.io/chefdk/.

    $ wget https://packages.chef.io/files/stable/chefdk/1.3.43/ubuntu/16.04/chefdk_1.3.43-1_amd64.deb
    
  2. Install the package, and the PATH will be set automatically,

    root@Mc:~# dpkg -i chef-server*
    
    root@Mc:~# chef
    chef         chef-apply   chef-client  chef-shell   chef-solo    chef-vault
    
    root@Mc:~# chef -v
    Chef Development Kit Version: 1.3.43
    chef-client version: 12.19.36
    delivery version: master (dd319aa632c2f550c92a2172b9d1226478fea997)
    berks version: 5.6.4
    kitchen version: 1.16.0
    
  3. Generate a cookbook:

    $ chef generate app first_cookbook
    

You can see more details from chef docs. Hope this helps.

Upvotes: 2

Related Questions