In this article I will show you how to install and configure a Chef 12 server that is used within your enterprise for IT automation.
The first thing we have to do is to install the chef server package and all its dependencies. I’ve created my own chef repository to store all packages that are needed for the server:
[root@Centos06-1 packages]# cd Chef/
[root@Centos06-1 Chef]# ll
-rw-r–r– 1 root root 52338858 Jun 4 10:03 chef-12.10.24-1.el6.x86_64.rpm
-rw-r–r– 1 root root 142488123 May 16 19:53 chefdk-0.14.25-1.el6.x86_64.rpm
-rwxr-xr-x. 1 apache apache 477870942 May 7 11:02 chef-server-core-12.6.0-1.el6.x86_64.rpm
drwxr-xr-x 2 root root 4096 Jun 4 10:04 repodata
Once I’ve placed all the rpm files there, I’ve created a new yum repository and now I can simply install the server by using the following command:
yum install -y chef-server-core
If you don’t have a local yum repository with the necessary chef package, you can download the package manually and use the rpm -Uvh chef-12.10.24-1.el6.x86_64.rpm command and wait for the installation to finish.
Now execute chef-server-ctl reconfigure to allow the server to configure and start all its services. Note that this part may take a long period of time until all the services are up and running.
Once the configuration is completed, it’s time to create our first admin account by using the following command:
chef-server-ctl user-create root root root firstname.lastname@example.org ‘Password’ –filename ~/.chef/root.pem
where the first root stands for username, the second one for first name, then the last name and the email. You’ll also have to add the password and the –filename parameter to save the user’s private key locally. This file is used later to interact with the chef server by using the cli.
To ensure that your username was created, run the chef-server-ctl user-list command:
[root@Centos06-1 chef]# chef-server-ctl user-list
You can delete a user with the following command: chef-server-ctl user-delete root
Now that we’ve created the admin user account, it’s time to create a new chef organization and associate this user account to it:
chef-server-ctl org-create ppscu ‘ppscu.com’ –association_user root –filename /etc/chef/ppscu-validator.pem
The validator file is used when you need to interact with the newly created organization
Once the organization has been created, run the following command to verify its config:
[root@Centos06-1 chef]# chef-server-ctl org-list
You can also install the chef-manage packet which adds the web interface that can be used to interact with the chef server. Run the following commands in order to configure chef-manage:
chef-server-ctl install chef-manage
Now you should have your chef server up and running with all the necessary services configured and the admin account assigned to a new organization.