Skip to content

Instantly share code, notes, and snippets.

@patb23
Last active June 5, 2017 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patb23/670a338819b35fd1b451e03854ffa81a to your computer and use it in GitHub Desktop.
Save patb23/670a338819b35fd1b451e03854ffa81a to your computer and use it in GitHub Desktop.
Install and configure Chef server in Centos.
  1. Install ChefDK and yum install the rpm https://downloads.chef.io/chefdk#el
  2. Install Chef Server by downloading from https://downloads.chef.io/chef-server#el
  3. run as su, chef-server-ctl reconfigure
  4. install chef-manage by running chef-server-ctl install chef-manage
  5. run chef-server-ctl reconfigure
  6. run chef-manage-ctl reconfigure
  7. Create a folder in your home directory - this will be the workspace to try recipes and cookbooks. let's call it 'learn-chef', switch to this folder and run the following:
sudo yum -y install git # if not installed
git init 
git remote add origin https://github.com/patb23/learning-chef-cloud
  1. create user, org in chef-server by running sudo chef-server-ctl user-create pattabi Pattabiraman M patxx@gmail.com 'password' --filename pattabi.pem sudo chef-server-ctl org-create dev "Development " --association_user pattabi --filename dev-validator.pem

  2. Login to management console. go to administration tab and select 'Generate Knife Config'. this will create the knife.rb file content will be as shown:

# See https://docs.getchef.com/config_rb_knife.html for more information on knife configuration options

current_dir = File.dirname(__FILE__)
log_level                :info
log_location             STDOUT
node_name                "pattabi"
client_key               "#{current_dir}/pattabi.pem"
chef_server_url          "https://localhost/organizations/dev"
cookbook_path            ["#{current_dir}/../cookbooks"]

This file along with the user pem (pattabi.pem) need to moved to a folder (your workspace, let's call it 'learn-chef') under .chef subfolder.

  1. Now we are armed with the swiss-knife to try recipes and publish cookbooks. Do these 2 additional steps to ensure connectivity with the Chef Server that was configured above.
knife ssl fetch
knife ssl check

If something goes wrong and/or want to remove the previously installed server, following gist is very useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment