MAC 安装 packer 1.7.2
1.创建目录并进入
$ mkdir -p $(go env GOPATH)/src/github.com/hashicorp && cd $_
2.下载源代码
$ git clone https://github.com/hashicorp/packer.git
3.切换到1.7.2发布版
$ git checkout 1f834e229aa722ea1279ec32503a2ea011f24e03
4.创建自己的分支
$ git switch -c yourname_dev
5.修改
当前项目目录下version/version.go 文件的第17行
const VersionPrerelease = "dev"
6.编译
$ make dev
7.编译完了之后
有两种做法,
1.修改系统环境变量。指向当前项目下刚生成的/bin/packer
2.将bin/packer复制到 /usr/local/bin/packer
8.新启一个终端
$ 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
```