How To Install Chef On CentOS 7

What is Chef

Chef is an automation tool that provides a way to define infrastructure as code. Infrastructure as code (IAC) simply means that managing infrastructure by writing code (Automating infrastructure) rather than using manual processes. It can also be termed as programmable infrastructure. Chef uses a pure-Ruby, domain-specific language (DSL) for writing system configurations. The “speed” of software development refers to how quickly the software is able to change in response to new requirements or conditions. Analysts measure speed in terms of both how frequently the software is deployed and the period of time between a new commit to the code base and the subsequent deployment.

Step 1: Installation and Configuration of Chef

First, we need to install Chef package on system.

curl -O https://packages.chef.io/files/stable/chef-server/13.1.13/el/8/chef-server-core-13.1.13-1.el7.x86_64.rpm

Next, RPM package installation.

rpm -Uvh chef-server-core-13.1.13-1.el7.x86_64.rpm

Step 2: Reconfiguring Chef

When the Chef package is installed, we will have access to the “chef-server-ctl” command. After this, we will need to reconfigure Chef to ready the Chef cookbooks. This reconfiguration may take anywhere from 5-30 minutes.

chef-server-ctl reconfigure

Once Chef is reconfigured, we can check the service list to get a list of available software using this command.

chef-server-ctl service-list

Step 3: Creating the Chef user and organization

User

Here are the parameters we will use.

  • Username: amal
  • First name: Amal
  • Last name: Krish
  • Password: [email protected]
  • Filename: Location where the key is going to authenticate the user later on (e.g akrish.pem)
chef-server-ctl user-create amal Amal Krish [email protected] '[email protected]' --filename /home/akrish/akrish.pem

Organization

Here are the parameters we will use.

  • Organization name: akweb
  • Full name: AkWeb
  • User assigned: amal
  • Filename: /home/akrish/org-validator.pem
chef-server-ctl org-create akweb 'AkWeb Inc.' --association_user Ml --filename /home/akrish/org-validator.pem

If we wanted to, we could stop right here as we have a Chef server, user, and organization running. With this information, we can set up everything that we need. If you would like to add additional plugins, like the web user interface for Chef.

Step 4: Chef-Manage Plugin

One of the most popular features that Chef users like to use is a plugin called Chef-Manage. Chef-Manage is a ruby-on-rails application that provides a web-user interface that will allow us to see the configuration, users we have, organizations, cookbooks, nodes, etc.

chef-server-ctl install chef-manage

After the installation of Chef-Manage, we will need to reconfigure Chef.

chef-server-ctl reconfigure

After we reconfigure Chef, we also need to reconfigure Chef-Manage, we can do that by running the following command.

chef-manage-ctl reconfigure

Once the Chef-Manage reconfiguration is done, you can access the login page of Chef.

https://132.23.51.26/login

Replace with your IP.

Conclusion

Chef is a configuration management tool that manages the infrastructure by writing code rather than using a manual process so that it can be automated, tested and deployed very easily. We hope you understand how chef works on CentOS. We at TheStack are certified trained professionals providing DevOps support services to the customers, coordinating and consulting with them for better product development and deployment. So, what are you waiting for? Get in touch with us to know more.

Related Articles