Packer may be installed in the following ways:
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 binary named packer
.
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 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 PATH
includes /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.
This Stack Overflow article contains instructions for setting the PATH on Windows through the user interface.
To compile from source, you will need Go installed and configured properly as well as a copy of git
in your PATH
.
Create a directory in your GOPATH for the code.
$ mkdir -p $(go env GOPATH)/src/github.com/hashicorp && cd $_
Clone the Packer repository from GitHub into your GOPATH
.
$ git clone https://github.com/hashicorp/packer
Change into the packer
directory.
Build Packer for your current system and put the binary in ./bin/
(relative to the git checkout). The make dev
target is just a shortcut that builds packer
for only your local build environment (no cross-compiled targets).
Homebrew is a free and open-source package management system for macOS. Install the official Packer formula from the terminal.
First, install the HashiCorp tap, a repository of all our Homebrew packages.
Now, install Packer with hashicorp/tap/packer
.
$ brew install hashicorp/tap/packer
Note
This installs a signed binary and is automatically updated with every new official release.
To update to the latest, run
$ brew upgrade hashicorp/tap/packer
Chocolatey is a free and open-source package management system for Windows.
If you're using Windows and Chocolatey, you can install Packer by running choco install
.
Note
The Chocolatey package is not currently maintained by HashiCorp.
HashiCorp officially maintains and signs packages for the following Linux distributions.
Add the HashiCorp GPG key.
$ curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
Add the official HashiCorp Linux repository.
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(grep -oP '(?<=UBUNTU_CODENAME=).*' /etc/os-release || lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
Update and install.
$ sudo apt-get update && sudo apt-get install packer
Install yum-config-manager
to manage your repositories.
$ sudo yum install -y yum-utils
Use yum-config-manager
to add the official HashiCorp Linux repository.
$ sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
Install.
$ sudo yum -y install packer
Install dnf config-manager
to manage your repositories.
$ sudo dnf install -y dnf-plugins-core
Use dnf config-manager
to add the official HashiCorp Linux repository.
$ sudo dnf config-manager addrepo --from-repofile=https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
Install.
$ sudo dnf -y install packer
Install yum-config-manager
to manage your repositories.
$ sudo yum install -y yum-utils
Use yum-config-manager
to add the official HashiCorp Linux repository.
$ sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
Install.
$ sudo yum -y install packer
Tip
Now that you have added the HashiCorp repository, you can install Terraform, Vault, Consul, and Nomad with the same command.
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 PATH
environment variable was not set up properly. Please go back and ensure that your PATH
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 Packer.
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, e.g. /usr/local/packer
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4