How to install and configure Standalone Chef Server and Chef Management Console on CentOS 7

How to install and configure Standalone Chef Server and Chef Management Console on CentOS 7

chef_server_setup

Here in this article we will try to install and configure Standalone Chef Server and Chef Management Console on CentOS 7 Linux Operating system.

Test Environment

CentOS7 Server

Procedure

Step1: Download the Chef Server package

Here we are going to download the chef server package and transfer it to the CentOS 7 machine.

URL - https://downloads.chef.io/chef-server/
Package - chef-server-core-12.15.7-1.el7.x86_64.rpm
[root@centos12 ~]# ls -ltr /root/Downloads/chef-server-core-12.15.7-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 208763407 Jun 17 17:07 /root/Downloads/chef-server-core-12.15.7-1.el7.x86_64.rpm

Step2: Install the Chef Server RPM package

Now let’s try to install the Chef Server package onto the CentOS server.

[root@centos12 ~]# yum install /root/Downloads/chef-server-core-12.15.7-1.el7.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining /root/Downloads/chef-server-core-12.15.7-1.el7.x86_64.rpm: chef-server-core-12.15.7-1.el7.x86_64
Marking /root/Downloads/chef-server-core-12.15.7-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package chef-server-core.x86_64 0:12.15.7-1.el7 will be installed
--> Finished Dependency Resolution
base/7/x86_64                                                                                                  | 3.6 kB  00:00:00
extras/7/x86_64                                                                                                | 3.4 kB  00:00:00
updates/7/x86_64                                                                                               | 3.4 kB  00:00:00
updates/7/x86_64/primary_db                                                                                    | 6.4 MB  00:00:46


Dependencies Resolved


======================================================================================================================================
 Package                      Arch               Version                     Repository                                          Size
======================================================================================================================================
Installing:
 chef-server-core             x86_64             12.15.7-1.el7               /chef-server-core-12.15.7-1.el7.x86_64             791 M


Transaction Summary
======================================================================================================================================
Install  1 Package


Total size: 791 M
Installed size: 791 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : chef-server-core-12.15.7-1.el7.x86_64                                                                              1/1
  Verifying  : chef-server-core-12.15.7-1.el7.x86_64                                                                              1/1


Installed:
  chef-server-core.x86_64 0:12.15.7-1.el7


Complete!

Validate the installation by checking the following utility.

[root@centos12 Downloads]# ls -ltr /usr/bin/chef-server-ctl
lrwxrwxrwx. 1 root root 32 Jun 22 23:48 /usr/bin/chef-server-ctl -> /opt/opscode/bin/chef-server-ctl

Step3: Configure the Chef Server services

Let’s try to configure the services using the below command.

[root@centos12 Downloads]# chef-server-ctl reconfigure
Starting Chef Client, version 12.19.36
resolving cookbooks for run list: ["private-chef::default"]
Synchronizing Cookbooks:
  - yum (3.13.0)
  - runit (3.0.5)
  - enterprise (0.10.3)
  - apt (6.1.0)
  - private-chef (0.1.0)
  - packagecloud (0.3.0)
  - yum-epel (2.1.1)
  - compat_resource (12.19.0)
  - openssl (7.0.1)


....
....


Chef Client finished, 493/1080 resources updated in 10 minutes 16 seconds
Chef Server Reconfigured!

After the Chef Server reconfigure is run it will configure the system by running multiple cookbooks and recipes and enable and run the required services that are needed.

If you look at the processes that got launched after reconfiguring your Chef Server you see something similiar as below.

[root@centos12 Downloads]# ps -ef | grep chef
root      10671   4402  0 00:01 ?        00:00:00 runsv opscode-erchef
root      11119   4402  0 00:02 ?        00:00:00 runsv opscode-chef-mover
opscode   12532  10671  0 00:06 ?        00:00:00 svlogd -tt /var/log/opscode/opscode-erchef
opscode   12598  10671 10 00:06 ?        00:00:09 /opt/opscode/embedded/lib/erlang/erts-7.3/bin/beam.smp -Bd -K true -A 5 -- -root /opt/opscode/embedded/service/opscode-erchef -progname opt/opscode/embedded/service/opscode-erchef/bin/oc_erchef -- -home /var/opt/opscode/opscode-erchef -- -noshell -noshell -noinput -boot /opt/opscode/embedded/service/opscode-erchef/releases/12.15.7+20170517144019/oc_erchef -mode embedded -boot_var ERTS_LIB_DIR /opt/opscode/embedded/lib/erlang/lib -config /opt/opscode/embedded/service/opscode-erchef/sys.config -name erchef@127.0.0.1 -setcookie erchef -smp enable -pa lib/patches -pa -- foreground
opscode   12843  11119  0 00:06 ?        00:00:00 svlogd -tt /var/log/opscode/opscode-chef-mover
opscode+  13064  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(35892) idle
opscode+  13065  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(32777) idle
opscode+  13068  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(36417) idle
opscode+  13070  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(60205) idle
opscode+  13071  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(57120) idle
opscode+  13072  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(33618) idle
opscode+  13073  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(60387) idle
opscode+  13074  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(43084) idle
opscode+  13075  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(58586) idle
opscode+  13076  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(38066) idle
opscode+  13077  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(57964) idle
opscode+  13078  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(37911) idle
opscode+  13079  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(59803) idle
opscode+  13080  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(51439) idle
opscode+  13081  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(52995) idle
opscode+  13082  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(40556) idle
opscode+  13083  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(57989) idle
opscode+  13084  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(40731) idle
opscode+  13085  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(49552) idle
opscode+  13086  12288  0 00:07 ?        00:00:00 postgres: opscode_chef opscode_chef 127.0.0.1(52100) idle
opscode   13087  12598  2 00:07 ?        00:00:00 ruby /opt/opscode/embedded/service/opscode-erchef/lib/chef_objects-12.15.7+20170517144019/priv/depselector_rb/depselector.rb
opscode   13089  12598  4 00:07 ?        00:00:00 ruby /opt/opscode/embedded/service/opscode-erchef/lib/chef_objects-12.15.7+20170517144019/priv/depselector_rb/depselector.rb
opscode   13093  12598  4 00:07 ?        00:00:00 ruby /opt/opscode/embedded/service/opscode-erchef/lib/chef_objects-12.15.7+20170517144019/priv/depselector_rb/depselector.rb
opscode   13095  12598  4 00:07 ?        00:00:00 ruby /opt/opscode/embedded/service/opscode-erchef/lib/chef_objects-12.15.7+20170517144019/priv/depselector_rb/depselector.rb
opscode   13097  12598  4 00:07 ?        00:00:00 ruby /opt/opscode/embedded/service/opscode-erchef/lib/chef_objects-12.15.7+20170517144019/priv/depselector_rb/depselector.rb
root      13114   3483  0 00:07 pts/0    00:00:00 grep --color=auto chef

Step4: Create an administrator user to manage the Chef Server

Here we will create Administrative user as shown below.

[root@centos12 Downloads]# chef-server-ctl user-create admin firstname lastname  first@gmail.com 'admin@1096' --filename /home/sbhoga/admin.pem

Step5: Create an Organization

Let’s create an Organization for our server as shown below.

[root@centos12 Downloads]# chef-server-ctl org-create chefregion 'chef region india' --association_user admin --filename /home/sbhoga//chefregion.pem

Step6: Install Chef Management Console

It’s time to install the Chef Management Console as shown below.

[root@centos12 Downloads]# chef-server-ctl install chef-manage
Starting Chef Client, version 12.19.36
resolving cookbooks for run list: ["private-chef::add_ons_wrapper"]
Synchronizing Cookbooks:
  - private-chef (0.1.0)
  - enterprise (0.10.3)
  - apt (6.1.0)
  - yum (3.13.0)
  - openssl (7.0.1)
  - runit (3.0.5)
  - packagecloud (0.3.0)
  - yum-epel (2.1.1)
  - compat_resource (12.19.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 4 resources
Recipe: private-chef::add_ons_wrapper
  * ruby_block[addon_install_notification_chef-manage] action nothing (skipped due to action :nothing)
  * remote_file[/var/opt/opscode/local-mode-cache/chef-manage-2.5.4-1.el7.x86_64.rpm] action create
    - create new file /var/opt/opscode/local-mode-cache/chef-manage-2.5.4-1.el7.x86_64.rpm
    - update content in file /var/opt/opscode/local-mode-cache/chef-manage-2.5.4-1.el7.x86_64.rpm from none to d01403
    (file sizes exceed 10000000 bytes, diff output suppressed)
    - restore selinux security context
  * ruby_block[locate_addon_package_chef-manage] action run
    - execute the ruby block locate_addon_package_chef-manage
  * yum_package[chef-manage] action install
    - install version 2.5.4-1.el7 of package chef-manage
  * ruby_block[addon_install_notification_chef-manage] action create
    - execute the ruby block addon_install_notification_chef-manage


Running handlers:
-- Installed Add-On Package: chef-manage
  - #<Class:0x00000007147308>::AddonInstallHandler
Running handlers complete


Deprecated features used!
  Property `sensitive` of resource `yum_repository` overwrites an existing method. Please use a different property name. This will raise an exception in Chef 13. at 1 location:
    - /var/opt/opscode/local-mode-cache/cookbooks/yum/resources/repository.rb:59:in `class_from_file'
   See https://docs.chef.io/deprecations_property_name_collision.html for further details.


Chef Client finished, 4/5 resources updated in 16 minutes 52 seconds

NOTE: This is going to download the package from https://packages.chef.io/by default

Step7: Run Chef Server reconfigure and then Chef Manage reconfigure

After the Management console installation, Let’s reconfigure our server and Chef manage as shown below.

[root@centos12 Downloads]# chef-server-ctl reconfigure
[root@centos12 Downloads]# chef-manage-ctl reconfigure --accept-license

After install the Chef Server and Chef Management Console. The disk occupied by these two softwares is as below.

[root@centos12 opt]# du -sh *
542M    chef-manage
937M    opscode

Step8: Validate the Chef Management Console

We can now access our Chef Management Console as shown below.

URL - https://FQDN/login

Hope you enjoyed reading this article. Thank you..