github.com/StackPointCloud/packer@v0.10.2-0.20180716202532-b28098e0f79b/website/source/intro/getting-started/install.html.md (about)

     1  ---
     2  layout: intro
     3  sidebar_current: intro-getting-started-install
     4  page_title: Install Packer - Getting Started
     5  description: |-
     6    Packer must first be installed on the machine you want to run it on. To make
     7    installation easier, Packer is distributed as a binary package for all supported
     8    platforms and architectures. This page will not cover how to compile Packer
     9    from source, as that is covered in the README and is only recommended for
    10    advanced users.
    11  ---
    12  
    13  # Install Options
    14  
    15  Packer may be installed in the following ways:
    16  
    17  1. Using a [precompiled binary](#precompiled-binaries); We release binaries
    18    for all supported platforms and architectures. This method is recommended for
    19    most users.
    20  
    21  2. Installing [from source](#compiling-from-source) This method is only
    22    recommended for advanced users.
    23  
    24  3. An unoffical [alternative installation method](#alternative-installation-methods)
    25  
    26  ## Precompiled Binaries
    27  
    28  To install the precompiled binary, [download](/downloads.html) the appropriate
    29  package for your system. Packer is currently packaged as a zip file. We do not
    30  have any near term plans to provide system packages.
    31  
    32  Next, unzip the downloaded package into a directory where Packer will be
    33  installed. On Unix systems, `~/packer` or `/usr/local/packer` is generally good,
    34  depending on whether you want to restrict the install to just your user or
    35  install it system-wide. If you intend to access it from the command-line, make
    36  sure to place it somewhere on your `PATH` before `/usr/sbin`. On Windows
    37  systems, you can put it wherever you'd like. The `packer` (or `packer.exe` for
    38  Windows) binary inside is all that is necessary to run Packer. Any additional
    39  files aren't required to run Packer.
    40  
    41  After unzipping the package, the directory should contain a single binary
    42  program called `packer`. The final step to
    43  installation is to make sure the directory you installed Packer to is on the
    44  PATH. See [this
    45  page](https://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux)
    46  for instructions on setting the PATH on Linux and Mac. [This
    47  page](https://stackoverflow.com/questions/1618280/where-can-i-set-path-to-make-exe-on-windows)
    48  contains instructions for setting the PATH on Windows.
    49  
    50  ## Compiling from Source
    51  
    52  To compile from source, you will need [Go](https://golang.org) installed and
    53  configured properly as well as a copy of [`git`](https://www.git-scm.com/)
    54  in your `PATH`.
    55  
    56  1.  Clone the Packer repository from GitHub into your `GOPATH`:
    57  
    58      ``` shell
    59      $ mkdir -p $(go env GOPATH)/src/github.com/hashicorp && cd $_
    60      $ git clone https://github.com/hashicorp/packer.git
    61      $ cd packer
    62      ```
    63  
    64  2.  Build Packer for your current system and put the
    65      binary in `./bin/` (relative to the git checkout). The `make dev` target is
    66      just a shortcut that builds `packer` for only your local build environment (no
    67      cross-compiled targets).
    68  
    69      ``` shell
    70      $ make dev
    71      ```
    72  
    73  ## Verifying the Installation
    74  
    75  After installing Packer, verify the installation worked by opening a new command
    76  prompt or console, and checking that `packer` is available:
    77  
    78  ```text
    79  $ packer
    80  usage: packer [--version] [--help] <command> [<args>]
    81  
    82  Available commands are:
    83      build       build image(s) from template
    84      fix         fixes templates from old versions of packer
    85      inspect     see components of a template
    86      push        push template files to a Packer build service
    87      validate    check that a template is valid
    88      version     Prints the Packer version
    89  ```
    90  
    91  If you get an error that `packer` could not be found, then your PATH environment
    92  variable was not setup properly. Please go back and ensure that your PATH
    93  variable contains the directory which has Packer installed.
    94  
    95  Otherwise, Packer is installed and you're ready to go!
    96  
    97  ## Alternative Installation Methods
    98  
    99  While the binary packages is the only official method of installation, there are
   100  alternatives available.
   101  
   102  ### Homebrew
   103  
   104  If you're using OS X and [Homebrew](http://brew.sh), you can install Packer by
   105  running:
   106  
   107      $ brew install packer
   108  
   109  ### Chocolatey
   110  
   111  If you're using Windows and [Chocolatey](http://chocolatey.org), you can
   112  install Packer by running:
   113  
   114      choco install packer
   115  
   116  ## Troubleshooting
   117  
   118  On some RedHat-based Linux distributions there is another tool named `packer`
   119  installed by default. You can check for this using `which -a packer`. If you get
   120  an error like this it indicates there is a name conflict.
   121  
   122      $ packer
   123      /usr/share/cracklib/pw_dict.pwd: Permission denied
   124      /usr/share/cracklib/pw_dict: Permission denied
   125  
   126  To fix this, you can create a symlink to packer that uses a different name like
   127  `packer.io`, or invoke the `packer` binary you want using its absolute path,
   128  e.g. `/usr/local/packer`.