This is a how to tutorial on setting up Chef a configuration management system and its components (Server, Workstation, and Node) on CentOS 6.3 64-bit. this is a systems and cloud infrastructure automation framework that makes it easy to deploy servers and applications to any physical, virtual, or cloud location, no matter the size of the infrastructure.

Chef Configuration Management

 

The client relies on abstract definitions (known as cookbooks and recipes) that are written in Ruby and are managed like source code. Each definition describes how a specific part of your infrastructure should be built and managed. The client then applies those definitions to servers and applications, as specified, resulting in a fully automated infrastructure. When a new node is brought online, the only thing the client needs to know is which cookbooks and recipes to apply.


Setup a Chef Server

The server acts as a hub for configuration data. The server stores cookbooks, the policies that are applied to nodes, and metadata that describes each registered node that is being managed by the client. Nodes use the client to ask the server for configuration details, such as recipes, templates, and file distributions. The client then does as much of the configuration work as possible on the nodes themselves (and not on the server). This scalable approach distributes the configuration effort throughout the organization.

Make sure you have a fully qualified domain name as your hostname

bash-shell# vim /etc/sysconfig/network
 
NETWORKING=yes
HOSTNAME=your-fqdn-hostname.com
 
bash-shell# hostname your-fqdn-hostname.com

Install and configure server

bash-shell# wget https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-server-11.0.10-1.el6.x86_64.rpm
bash-shell# yum install -y chef-server-11.0.10-1.el6.x86_64.rpm
bash-shell# chef-server-ctl reconfigure

Verify your install

bash-shell# chef-server-ctl test

Go into your browser to your Chef server https://your-fqdn-hostname.com

The default User Name is: admin

The default password is: p@ssw0rd1

Make sure you change the default password after login.


Setup a Workstation

The workstation is where you will be doing your work prior to uploading to the Server which will be used by the nodes.

Install some dependencies

bash-shell# yum install -y git

Install Chef

bash-shell# curl -L https://www.opscode.com/chef/install.sh | bash

Verify install

bash-shell# chef-client -v

Clone Chef repo

bash-shell# cd ~
bash-shell# git clone git://github.com/opscode/chef-repo.git

Configure Chef

bash-shell# cd chef-repo/
bash-shell# mkdir -p ~/chef-repo/.chef
bash-shell# echo '.chef' >> .gitignore
bash-shell# echo 'export PATH="/opt/chef/embedded/bin:$PATH"' >> ~/.bash_profile && source ~/.bash_profile
bash-shell# cd ~/chef-repo/.chef

Copy your chef-validator.pem and admin.pem Chef server /etc/chef-server to ~/chef-repo/.chef/

bash-shell# chmod 600 ~/chef-repo/.chef/*.pem

Create a knife.rb configuration file

bash-shell# knife configure --initial
 
WARNING: No knife configuration file found
Where should I put the config file? ~/chef-repo/.chef/knife.rb
Please enter the chef server URL: https://us-east-chef-server-01.givit.com:443
Please enter a name for the new user: knife
Please enter the existing admin name: [admin] 
Please enter the location of the existing admin's private key: ~/chef-repo/.chef/admin.pem
Please enter the validation clientname: [chef-validator] 
Please enter the location of the validation key: ~/chef-repo/.chef/chef-validator.pem
Please enter the path to a chef repository (or leave blank): 
Creating initial API user...
Please enter a password for the new user: 
Created user[knife]
Configuration file written to ~/chef-repo/.chef/knife.rb

Verify your workstation install

bash-shell# knife client list
 
chef-validator
chef-webui
 
bash-shell# knife user list
 
admin
knife

Setup a Node

A node is any physical, virtual, or cloud machine that is configured to be maintained by a client.

Make sure you have a fully qualified domain name as your hostname

bash-shell# vim /etc/sysconfig/network
 
NETWORKING=yes
HOSTNAME=your-fqdn-hostname.com
 
bash-shell# hostname your-fqdn-hostname.com

Install Chef

bash-shell# curl -L https://www.opscode.com/chef/install.sh | bash
bash-shell# mkdir /etc/chef
bash-shell# cd /etc/chef/

Copy your chef-validator.pem from the Chef server /etc/chef-server to /etc/chef/

bash-shell# chmod 600 /etc/chef/*.pem

Register your Chef node

chef-client -S https://your-fqdn-hostname-of-chef-server.com -K /etc/chef/chef-validator.pem

Setup your Chef client.rb file

bash-shell# vim client.rb
 
log_level        :info
  log_location     STDOUT
  chef_server_url  'https://your-fqdn-hostname-of-chef-server.com'

Verify your node install

bash-shell# chef-client

Your next step is to find and implement a recipe. I hope this tutorial helps you get your Chef components setup. As always, If you have any questions of comments, simply fill out the form bellow and I will be happy to answer you back.



Tags: , , , , , ,

Spin up a cloud server in no time flat

Simple setup. Full root access. Straightforward pricing.


DEPLOY SERVER




2 Responses to “How To Install Chef, Configuration Management Server, Workstation And Node”

Leave a Reply