Installing Packer For Image Creation

July 3, 2019

Now that we have installed chefdk and are connected to our aws via saml let’s install Packer to help us create (and later automate) the creation of a preconfigured AWS server.

First we need to install Golang. For this, I used Brew as installing from source see way too complicated.

brew install go

For packer however, once Golang is installed, it seems rather straight forward to install from source.

mkdir -p ~/src && \
  cd ~/src && \
  git clone https://github.com/hashicorp/packer.git && \
  cd packer && \
  make dev

The installed things into ~/src/packer. Let’s make the packer tools available from anywhere on your machine by adding it to your path.

vi ~/.bash_profile

And in there add a line that looks like the following

...
PATH="$HOME/src/packer/bin:$PATH"
...
export PATH

If everything worked as expected then open up a new terminal, and check the version of your installed packer

$ packer -v

Tags: