What is Chef?
Chef is a popular, open-source, IaC (Infrastructure as Code) management tool. It eases administration, configuration, and deployment of server resources across a network from a central location.
What is IaC?
IaC (or Infrastructure as code) is the procedure of provisioning, coordinating, and controlling servers via machine-readable files, that are defined in commonly reused records called cookbooks rather than physical hardware configuration or interactive configuration tools.
- Ensure that each computer that will be a node is running on a supported platform.
- Ensure that the server is sufficiently powerful to run the software.
- Ensure that all firewall and network settings are correctly configured in advance.
- The NTP service (Network Time Protocol) is enabled to prevent clock drift.
Installation and Configuration of Chef
First, we need to download and install the RPM package. Here is the command to pull that RPM to the server.
[root@host tmp]# 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 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 327M 100 327M 0 0 4511k 0 0:01:14 0:01:14 --:--:-- 4337k [root@host tmp]#
To install the package, we use this command.
[root@host tmp]# rpm -Uvh chef-server-core-13.1.13-1.el7.x86_64.rpm warning: chef-server-core-13.1.13-1.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY Preparing... ################################# [100%] Updating / installing... 1:chef-server-core-13.1.13-1.el7 ################################# [100%] [root@host tmp]#
Once the core 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.
[root@host tmp]# chef-server-ctl reconfigure +---------------------------------------------+ Chef License Acceptance Before you can continue, 3 product licenses must be accepted. View the license at https://www.chef.io/end-user-license-agreement/ Licenses that need accepting: * Chef Infra Server * Chef Infra Client * Chef InSpec Do you accept the 3 product licenses (yes/no)? > yes Persisting 3 product licenses... ✔ 3 product licenses persisted. +---------------------------------------------+ Starting Chef Infra Client, version 15.4.45 resolving cookbooks for run list: ["private-chef::default"] Synchronizing Cookbooks: - private-chef (0.1.1) - enterprise (0.15.1) - runit (5.1.1) - packagecloud (1.0.1) - yum-epel (3.3.0) Installing Cookbook Gems: Compiling Cookbooks... Recipe: private-chef::default ... ... ... ... Running handlers: Running handlers complete Chef Infra Client finished, 482/1032 resources updated in 02 minutes 45 seconds Chef Server Reconfigured! [root@host tmp]#
Once Chef is reconfigured, we can check the service list to get a list of available software.
[root@host tmp]# chef-server-ctl service-list bookshelf* nginx* oc_bifrost* oc_id* opscode-erchef* opscode-expander* opscode-solr4* postgresql* rabbitmq* redis_lb* [root@host tmp]#
Creating The Chef user
Once Chef is installed and configured, we will need to create a Chef user.
Here are the parameters we will use.
- Username: denis
- First name: Denis
- Last name: Bosack
- Password: p@Assw0rd
- Filename: Location where the key is going to authenticate the user later on (e.g dbosack.pem)
[root@host]# chef-server-ctl user-create denis Denis Bosack firstname.lastname@example.org 'p@Assw0rd' --filename /home/dbosack/dbosack.pem
Creating An Organization
Next, we can create an organization. Here are the parameters we will use.
- Organization name: liquidweb
- Full name: LiquidWeb
- User assigned: denis
- Filename: /home/dbosack/org-validator.pem
[root@host]# chef-server-ctl org-create liquidweb 'LiquidWeb Inc.' --association_user denis --filename /home/dbosack/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, follow the added steps below.
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.
[root@host dbosack]# chef-server-ctl install chef-manage
After the installation of Chef-Manage, we will need to reconfigure Chef again.
[root@host tmp]# chef-server-ctl reconfigure
Since Chef uses a test and repair approach, the settings that were previously configured would not need to be adjusted or overwritten since there were no modifications. This time, the reconfiguration should be much faster than the first time.
After we reconfigure Chef, we also need to reconfigure Chef-Manage, we can do that by running the following command:
[root@host]# chef-manage-ctl reconfigure
Once the Chef-Manage reconfiguration is done, you can access the login screen by typing your public IP address in a browser: https://188.8.131.52/login.
You’re Running Out Of Time!
Liquid Web has a lock on the best deals right including 33% off the first three months on a new dedicated server. This could be your perfect Python development environment to run your app on!
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.