How To Install packer on Debian 9

In this tutorial we learn how to install packer on Debian 9. packer is tool for creating machine images for multiple platforms

Introduction

In this tutorial we learn how to install packer on Debian 9.

What is packer

packer is:

Packer is a CLI tool for the automatic creation of identical machine images (single deployable units that contain a pre-configured OS and installed software) for multiple platforms (public cloud providers, private cloud and desktop virtualization solutions) from a single JSON template resp. configuration file.

Packer features builders for the following target platforms which could be employed on Debian:

  • Amazon Web Services (EBS-backed Amazon Machine Images for EC2, and other types)
  • Microsoft Azure (VHDs in the Azure Resource Manager)
  • DigitalOcean (reuseable snapshots from available source images)
  • Docker
  • Google Compute Engine (images based on existing images)
  • OpenStack (new reuseable images for servers in OpenStack clouds)
  • QEMU (KVM and Xen virtual machine images)
  • Oracle VirtualBox (virtual machine images)

A number of post-processors are included like for creating Vagrant boxes.

Several provisioners resp. remote execution systems, namely Ansible, Chef, Puppet, Salt, and shell based provisioning (using SSH) are supported to configure and install software on the machines automatically after fresh OSs have been set up. Provisioning Windows machines via Windows shell and PowerShell is included (using WinRM).

For the documentation of Packer, please see https://www.packer.io/docs.

There are three methods to install packer 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 packer Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install packer

Install packer Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install packer using apt by running the following command:

sudo apt -y install packer

Install packer 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 packer using aptitude by running the following command:

sudo aptitude -y install packer

How To Uninstall packer on Debian 9

To uninstall only the packer package we can use the following command:

sudo apt-get remove packer

Uninstall packer And Its Dependencies

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

sudo apt-get -y autoremove packer

Remove packer Configurations and Data

To remove packer configuration and data from Debian 9 we can use the following command:

sudo apt-get -y purge packer

Remove packer configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge packer

Dependencies

packer have the following dependencies:

References

Summary

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