Packer may be installed in the following ways:
- Using a precompiled binary. We release binaries for all supported platforms and architectures. This method is recommended for most users.
- Installing from source. This method is only recommended for advanced users.
- Using your system's package manager.
Retrieve the packer binary by downloading a pre-compiled binary or compiling it from source.
To install the precompiled binary, download the appropriate package for your system. Packer is currently packaged as a zip file.
After downloading Packer, unzip the package. Packer runs as a single
Finally, make sure that the
packer binary is available on your
PATH. This process will differ depending on your operating system.
Print a colon-separated list of locations in your
$ echo $PATH
Move the Packer binary to one of the listed locations. This command assumes that the binary is currently in your downloads folder and that your
/usr/local/bin, but you can customize it if your locations are different.
$ mv ~/Downloads/packer /usr/local/bin/
For more detail about adding binaries to your path, see this Stack Overflow article.
After installing Packer, verify the installation worked by opening a new command
prompt or console, and checking that
packer is available:
$ packer 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 validate check that a template is valid version Prints the Packer version
If you get an error that
packer could not be found, then your
variable was not set up properly. Please go back and ensure that your
variable contains the directory which has Packer installed.
Otherwise, Packer is installed and you're ready to go!
On some distributions, there may be another tool named
packer installed by
default. The following error indicates that there is a name conflict.
$ packer /usr/share/cracklib/pw_dict.pwd: Permission denied /usr/share/cracklib/pw_dict: Permission denied
Note: On Arch Linux, there is a package named
packer in the main
repository and in the AUR. The package
packer in the AUR is an old
name for a package management tool for Arch, it's not HashiCorp
To fix this, create a symlink to
packer that uses a different name like
packer.io, or invoke the
packer binary you want using its absolute path,