install packer on linux

Introduction

In this post I will cover installation of Hashicorp Packer on my Linux box (Pop!_OS / Ubuntu). Packer has a repository that can easily be added, making the process simple and familiar.

Instructions at developer.hashicorp.com

Following the installation instructions provided at developer.hashicorp.com , the process is familiar for many packages. Be sure to select "Ubuntu/Debian" to follow along.

  • First, add the HashiCorp GPGKey
    $ wget -O - https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
  • Next, add the repository
    $ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
  • Finally, update and install packer
    $ sudo apt update 
    $ sudo apt install packer

Verifying the installation

A simple verification of the installation can be had by checking the version and help:

$ packer --version
Packer v1.12.0

$ packer --help
Usage: packer [--version] [--help] <command> [<args>]

Available commands are:
build build image(s) from template
console creates a console for testing variable interpolation
fix fixes templates from old versions of packer
fmt Rewrites HCL2 config files to canonical format
hcl2_upgrade transform a JSON template into an HCL2 configuration
init Install missing plugins or upgrade plugins
inspect see components of a template
plugins Interact with Packer plugins and catalog
validate check that a template is valid
version Prints the Packer version

Further information

My goal is to use Packer and Ansible to create digitalocean droplets that are quick and easy to scale as needed. This is part of my attempt to implement Infrastructure as code (IaC) in my projects (even simple projects). If you'd like to follow along, check out the devops tag or infrastructure as code (IaC) tag . I'm not an expert, but I'm sure I'll get the basics going!