Chef Tutorials – Part 1 – Configuring A Chef Infrastructure Server

Introduction

This tutorial will be a multi-part series describing how to use Chef Infra. I am making this series to help cement my knowledge of the Chef ecosystem, and provide the knowledge I am earning to other people without too many layers of abstraction. If you have been following my daily notes for the last week or so, you would see that I have been trying to stand up a Chef Infrastructure Server and Client Configuration. I do believe that I have done this, and done it correctly. Below is an annotated command list which describes the process I used to configure my Chef Infra environment. Note, what is not described is how I used Proxmox to generate the virtual machines which make up the server and clients. At some point I may create a post about my Proxmox environment. If you are interested in such an article, please do let me know.

Assumptions

  1. Ubuntu 18.04 Server with static IP Assignment and DNS preconfigured.
  2. 8 GB of Ram allocated to the server.
  3. 2 Dedicated Cores allocated to the server.
  4. 50 GB of storage space allocated to the server.
  5. SSH enabled on the server.

Step 1 – Download the installation package

$ wget https://packages.chef.io/files/stable/chef-server/14.0.65/ubuntu/18.04/chef-server-core_14.0.65-1_amd64.deb

I recommend wget from your Chef Infra server directly to access the installation media. I found the link by going to https://downloads.chef.io/products/infra-server, right clicking on the ubuntu 18.04 download, and pasting the link into my wget command in the terminal.

Step 2 – Install the Chef Infra Server package

$ apt update -y && sudo apt upgrade -y
$ apt install ./chef-server-core_14.0.65-1_amd64.deb -y
$ chef-server-ctl reconfigure

This will install the Chef Infra server onto your computer. This installation usually takes a while. To verify that the installation was successful, from your web browser, go to the address of your server instance. If you are greeted by the message below, it was successful.

CCHEF 
Are You Looking For the Chef Infra Server? 
like trying Chef 
um Intra al L.-n Cnel 
API

Step 3 – Install the Management WebUI

$ chef-server-ctl install chef-manage
$ chef-manage-ctl reconfigure --accept-license

The reconfiguring step usually takes a while to process. Once it has finished, you should now be able to go to your chef infra server in your web browser, and be greeted with the screen below. Even though you can see a login screen, you wont be able to log in at this point.

Step 4 – Create a Chef Infra Management User

$ chef-server-ctl user-create <username> <first name> <last name> <email address> <management password> --filename <rsa.pub location>

Above is the code format I used to create a user account with chef-server-cli. Replace the contents inside the brackets with the appropriate information. This command will create the account you will use to log into the chef management website. Below is what I put in for my user-create command:

$ chef-server-ctl user-create littleseneca myname email.blank@email.com 'password is swordfish' --filename /home/administrator/id_rsa.pub

Step 5 – Create a Chef Infra Organization

$ chef-server-ctl org-create <short org name> <longform org name> --association_user <username> --filename <organization.pem location>

Above is the code format I used to create a new organization with Chef-Server-CLI. As with the management user creation, replace the contents in the brackets with the content relevant to your organization. This organization is how you will structure your client devices attached to the chef infra server. The user account created in Step 4 will be tied to this organizational structure. Below is the specific code I used to create my organization:

$ chef-server-ctl org-create brooksnet 'Brooks Devops Inc.' --association_user littleseneca --filename /home/administrator/brooksnet-validator.pem

Step 6 – Verify User Login to Chef Infra Server

You now have a fully configured Chef Infra Server! Congrats. To make sure it worked correctly, go to your chef server in your web browser and log in with the information you configured in steps 4 and 5. If everything worked correctly, you should be greeted by a page that looks something like this:

Stay Tuned for Part 2 of this series, in which I build out the Chef Workstation Development environment!

Leave a Comment