Tuesday, June 30, 2015

What is Chef (Part 1)



Hello All,
Chef is an awesome Configuration Management Tool to automate your IT and it’s open source and supported by a community of system administrators and developers. Chef configures and manages your infrastructure no matter if it’s on-premises or in the cloud. You can also use Chef for application deployment. Basically, with Chef, you change your infrastructure to code and have some of the same characteristics of applications such as testing, repeating, and versioning. 


With Chef, your infrastructure is consistent, which means instead of configuring servers manually, you can automate it with Chef in such a way that meets security and compliance requirements and avoid repeating tasks. And in general, servers that configures manually are so fragile and hard to understand and modify and debug. This would be worse if the number of servers goes high, let’s say above 20 servers. And most importantly, it’s really easy to rebuild the servers with Chef from scratch and this is not the case for those servers that are built manually. A good example can be losing a server for whatever reason, let’s say a virus or disk failures, and restoring your servers with all the same configuration automatically and quickly.

You can install Chef on Linux, Mac OS, and Windows,  but I am going to install Chef on CentOS 6.0. First of all, you need to download the installation package. Go to https://downloads.chef.io/index.html and select Chef Development Kit.

                                                                           Figure 1



 In the next page, I selected Red Hat Enterprise Linux which is good for CentOS as well in my case. 


                                                                              Figure 2


Then select either Linux 6 or Linux 7, whatever fits your requirement in your environment. In my case, I chose Linux 6. 

                                                                                     Figure 3

Now, open terminal and run the below command to install Chef:
Note: depends on your version of package, you may change the numbers
rpm -Uvh chefdk-0.6.2-1.el6.x86_64.rpm

                                                                                      Figure 4


Now, verify that ruby has been installed in correct location (/opt/chefdk/embedded/bin/ruby). Also, make sure ruby is in the PATH. If not, add it by export command:
export PATH=”/opt/chefdk/embedded/bin:$PATH”

                                                                                     Figure 5


Then make sure all Chef components has been installed successfully. Run the below command:
ls /opt/chedk/bin
Also, verify the chef client version.

                                                                                      Figure 6


And that’s all for part 1. In part 2, I will show you some simple example and going through basic commands.

Hope you enjoyed,
Khosro Taraghi