Install Packer on Linux
26th April 2019
Introduction
Packer is another fantastic tool in the infrastructure as code tool belt from Hashicorp. Packer allows you to build base or golden images for Hypervisors such as KVM, Virtualbox and VMware based on configuration files. But that is not all, it can even build images for cloud providers such as Azure, AWS as well as Docker and LXC. That is pretty baller when you think about it.
In this post I will show you how to install Packer on a Linux machine. I will be installing Packer on an Ubuntu machine, but the instructions are compatible with most other modern linux distributions.
The following code versions will be used in this lab.
- Ubuntu - 1804
- Packer - 1.4.0
Installation
Download Packer
wget https://releases.hashicorp.com/packer/1.4.0/packer_1.4.0_linux_amd64.zip
Unzip Packer zipfile.
unzip packer_1.4.0_linux_amd64.zip
Move Packer executable to /opt directory.
sudo mkdir /opt/packer/
sudo mv packer /opt/packer/packer
Link Packer executable to a location in your $PATH.
sudo ln -s /opt/packer/packer /usr/local/bin/packer
Testing
Confirm the packer
command is available.
which packer
# output
/usr/local/bin/packer
Check the version of Packer.
packer --version
# output
1.4.0
Summary
You now have a working Packer install so go out and build some infrastructure as code already.