How To Install python-chef on Debian 9

In this tutorial we learn how to install python-chef on Debian 9. python-chef is Python API for interacting with a Chef server

Introduction

In this tutorial we learn how to install python-chef on Debian 9.

What is python-chef

python-chef is:

pychef provides a library with a client and a high-level abstraction API to interact with a Chef server.

Chef is a systems and cloud infrastructure automation framework that makes it easy to deploy servers and applications to any physical, virtual, or cloud location, no matter the size of the infrastructure.

pychef provides all expected features needed to interact with Chef server API:

  • Nodes
  • Roles
  • Data bags
  • Environments
  • Search

pychef additionally provides integration with Fabric (remote deployment tool) as an extra feature.

There are three methods to install python-chef on Debian 9. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-chef Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python-chef using apt-get by running the following command:

sudo apt-get -y install python-chef

Install python-chef Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python-chef using apt by running the following command:

sudo apt -y install python-chef

Install python-chef Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python-chef using aptitude by running the following command:

sudo aptitude -y install python-chef

How To Uninstall python-chef on Debian 9

To uninstall only the python-chef package we can use the following command:

sudo apt-get remove python-chef

Uninstall python-chef And Its Dependencies

To uninstall python-chef and its dependencies that are no longer needed by Debian 9, we can use the command below:

sudo apt-get -y autoremove python-chef

Remove python-chef Configurations and Data

To remove python-chef configuration and data from Debian 9 we can use the following command:

sudo apt-get -y purge python-chef

Remove python-chef configuration, data, and all of its dependencies

We can use the following command to remove python-chef configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python-chef

Dependencies

python-chef have the following dependencies:

References

Summary

In this tutorial we learn how to install python-chef package on Debian 9 using different package management tools: apt, apt-get and aptitude.