Thursday, October 31, 2024
Google search engine
HomeGuest BlogsUpgrade Chef Server to latest release on CentOS 7 / Ubuntu 18.04

Upgrade Chef Server to latest release on CentOS 7 / Ubuntu 18.04

Chef is the leading open source continuous infrastructure and applications automation tool that takes you all the way from development to production. Our previous guide covered the installation of Chef Server on Ubuntu 18.04 LTS.

How to install Chef Automation Server on Ubuntu 18.04 LTS

This guide will focus on upgrading of already installed standalone Chef Server configuration. I’ll try to make a guide on the installation of Chef Automation server on a CentOS 7 machine.

Upgrading Chef Server

Follow our steps below to upgrade your Chef server to the latest release.

Step 1: Backup Chef Server Data

Run the following command to make sure all services are in a sane state and backup all Chef data.

$ chef-server-ctl reconfigure

Backup the data:

# chef-server-ctl backup --yes
Locating rsync..
/bin/rsync
Starting Chef Server backup
Bringing down the Chef Server
ok: down: bookshelf: 1s, normally up
ok: down: nginx: 0s, normally up
ok: down: oc_bifrost: 0s, normally up
ok: down: oc_id: 0s, normally up
ok: down: opscode-chef-mover: 302s, normally up
ok: down: opscode-erchef: 0s, normally up
ok: down: opscode-expander: 1s, normally up
ok: down: opscode-solr4: 0s, normally up
ok: down: rabbitmq: 0s, normally up
ok: down: redis_lb: 0s, normally up
Dumping Postgresql database to /tmp/chef_backup20181030-11018-1r60p82/chef_backup-2018-10-30-14-44-09.sql
could not change directory to "/tmp/d20181030-11018-1jnkroq": Permission denied
ok: down: postgresql: 0s, normally up
Writing backup manifest
Creating backup tarball
/opt/opscode/embedded/lib/ruby/gems/2.5.0/gems/mixlib-shellout-2.3.2/lib/mixlib/shellout/unix.rb:185: warning: conflicting chdir during another chdir block
tar: Removing leading `/' from member names
Bringing up the Chef Server
ok: run: bookshelf: (pid 11293) 0s
ok: run: nginx: (pid 11372) 1s
ok: run: oc_bifrost: (pid 11386) 1s
ok: run: oc_id: (pid 11467) 0s
ok: run: opscode-chef-mover: (pid 11482) 0s
ok: run: opscode-erchef: (pid 11559) 0s
ok: run: opscode-expander: (pid 11911) 0s
ok: run: opscode-solr4: (pid 12052) 0s
ok: run: postgresql: (pid 12090) 0s
ok: run: rabbitmq: (pid 11561) 13s
ok: run: redis_lb: (pid 12357) 1s
Exporting tarball to /var/opt/chef-backup
Cleaning up /tmp/chef_backup20181030-11018-1r60p82
Backup Complete!

Confirm backup file

# ls /var/opt/chef-backup/
chef-backup-2018-10-30-14-44-09.tgz

Step 2: Download and Upgrade Chef Server

Download the latest release of Chef server from the Official Downloads page. The example below downloads latest release of Chef for CentOS 7.

Ubuntu 18.04:

sudo apt update
sudo apt -y install wget
wget https://packages.chef.io/files/stable/chef-server/13.2.0/ubuntu/18.04/chef-server-core_13.2.0-1_amd64.deb

CentOS 7:

sudo dnf -y wget
wget https://packages.chef.io/files/stable/chef-workstation/20.7.96/el/7/chef-workstation-20.7.96-1.el7.x86_64.rpm

After downloading the package, install it with your distribution package manager.

sudo yum localinstall <package.rpm>

-- Example ---
sudo yum -y localinstall chef-workstation-20.7.96-1.el7.x86_64.rpm

For Ubuntu, use:

sudo dpkg -i  <package.deb>

--- Example ---
sudo apt install ./chef-server-core_13.2.0-1_amd64.deb

Sample output:

Running transaction
  Updating   : chef-server-core-12.18.14-1.el7.x86_64 [######################################################                                   ] 1/  Updating   : chef-server-core-12.18.14-1.el7.x86_64 [#######################################################                                  ] 1/  Updating   : chef-server-core-12.18.14-1.el7.x86_64 [########################################################                                 ] 1/  Upda  Updating   : chef-server-core-12.18.14-1.el7.x86_64                                                                                             1/2 
You have upgraded Chef Server!
......
For detailed upgrade instructions please see:
https://docs.chef.io/upgrade_server.html
  Cleanup    : chef-server-core-12.17.33-1.el7.x86_64                                                                                             2/2 
warning: file /opt/opscode/embedded/service/oc_id/log/development.log: remove failed: No such file or directory
  Verifying  : chef-server-core-12.18.14-1.el7.x86_64                                                                                             1/2 
  Verifying  : chef-server-core-12.17.33-1.el7.x86_64    
Updated:
  chef-server-core.x86_64 0:12.18.14-1.el7
Complete!                                                                                  2/2

The next step in the upgrade process is to run:

$ sudo chef-server-ctl upgrade

After the upgrade command completes, your Chef services will remain in a down state. To bring them back up run:

$ sudo  sudo chef-server-ctl start
ok: run: bookshelf: (pid 14176) 1s
ok: run: nginx: (pid 14233) 0s
ok: run: oc_bifrost: (pid 14255) 1s
ok: run: oc_id: (pid 14289) 0s
ok: run: opscode-chef-mover: (pid 14332) 0s
ok: run: opscode-erchef: (pid 14335) 1s
ok: run: opscode-expander: (pid 14475) 0s
ok: run: opscode-solr4: (pid 14705) 0s
ok: run: postgresql: (pid 14145) 189s
ok: run: rabbitmq: (pid 14337) 1s
ok: run: redis_lb: (pid 15079) 1s

Finally, remove the configuration files, logs, directories, users, etc. that were used by internal services and have been removed from this version of Chef Server:

$ sudo chef-server-ctl cleanup

You can add the --no-op option to see what would be removed by this command. Also check:

How to configure Chef Knife, Upload Cookbooks and Run a recipe on Chef Client Nodes

How to install Chef Development Kit / Workstation on Ubuntu 18.04

How to install Chef Development Kit on Arch Linux

Learning materials:

RELATED ARTICLES

Most Popular

Recent Comments