How Do You Deploy a Standalone Chef Server to a Linux Server?

Updated 10/13/19

Problem scenario
You want to deploy Chef server to Linux in a standalone fashion.  What do you do?

Solution
This solution has been tested to work with Ubuntu 16.04 Linux in AWS or Azure.  This solution has also been tested to work with RHEL 7.4 in AWS.

#1  For a standalone deployment, you will need a server with 4 CPU cores and 4 GB of RAM according to this link.  But if your server will not be utilized much, our tests were successful with deploying Chef server to VMs with the following characteristics:

  • 2 vCPU cores and 1.75 GB of RAM will work on Ubuntu 16.x in Azure
  • 2 vCPU cores and 3.75 GB of RAM will work on Ubuntu 16.x or 18.x in AWS
  • 2 vCPU cores and 4 GB of RAM will work on RHEL 7.4 in AWS

You may want to resize your VM, or upgrade the physical server, to have more RAM.  Click here for AWS resizing directions or here for GCP resizing directions.  If you have ample hard disk space but insufficient memory, you may want to see this posting for directions for adding or configuring virtual memory.

#2 a) Log in. 
      b) If the server is running Ubuntu, run these two commands:
curl https://packages.chef.io/files/stable/chef-server/12.17.5/ubuntu/16.04/chef-server-core_12.17.5-1_amd64.deb > /tmp/chef-server-core_12.17.5-1_amd64.deb

# If you want the most recent .deb file, you may want to go to the official Chef website to check.

sudo dpkg -i /tmp/chef-server-core_*.deb

     c)  If the server is Red Hat, run these two commands:
curl https://packages.chef.io/files/stable/chef-server/12.17.5/el/7/chef-server-core-12.17.5-1.el7.x86_64.rpm > /tmp/chef-server-core-12.17.5-1.el7.x86_64.rpm

# If you want the most recent .rpm file, you may want to go to the official Chef website to check. 

sudo yum -y localinstall /tmp/chef-server-core-12.17.5-1.el7.x86_64.rpm

#3.a. Run this command:

sudo chef-server-ctl reconfigure

3.b. Run this command:

sudo cp /opt/opscode/embedded/service/omnibus-ctl/spec/fixtures/pivotal.rb /etc/opscode/

3.c. Run this command:

sudo chef-server-ctl reconfigure

#4  Modify this command for your environment, then run it:

sudo chef-server-ctl user-create USER_NAME FIRST_NAME LAST_NAME EMAIL 'PASSWORD' --filename FILE_NAME

# Above command was mostly taken from https://docs.chef.io/install_server.html#standalone

Here is an example of how it may look:
sudo chef-server-ctl user-create contint Continual Integration dne@doesnotexist.com 'abcd1234' --filename /home/ubuntu/contint.pem

#5  Modify this command for your environment, then run it:

sudo chef-server-ctl org-create short_name 'full_organization_name' --association_user user_name --filename ORGANIZATION-validator.pem

# Above command was mostly taken from https://docs.chef.io/install_server.html#standalone

Here is an example of how it may look:

sudo chef-server-ctl org-create companynickname 'Continual Integration' --association_user contint --filename contint-validator.pem

#6  Run these three commands:
sudo chef-server-ctl install chef-manage

sudo chef-server-ctl reconfigure

sudo chef-manage-ctl reconfigure

# Agree to the license for the last command if you can (e.g., it is ok with your employer).  Press 'q" then type "yes" with no quotes and press enter.

#7  If the chef-server-ctl command works, then Chef server was installed.  You may want to try this command as a test:

sudo chef-server-ctl user-list

To see more information about your deployment, run this command:

sudo cat /opt/opscode/version-manifest.txt

FYI
Now would be a good time to install and configure knife.  Chef server is merely installed.  For most purposes, you will need knife.  To install and configure knife, see this posting, and look at the "Prerequisites" that correspond with your distribution of Linux.

Leave a comment

Your email address will not be published. Required fields are marked *