読者です 読者をやめる 読者になる 読者になる

AKAI TSUKI

System development or Technical something

install packer

packerをCentOS環境にインストールしてみました。

1. packerを取得

# wget https://dl.bintray.com/mitchellh/packer/0.5.1_linux_amd64.zip

# mkdir packer

ダウンロードした際に、なぜか長い名前になるので適当にリネームする
# mv (長い名前は略)filename\=0.5.1_linux_amd64.zip  packer/packer_0.5.1_linux_amd64.zip

2. 取得したファイルを展開

# cd packer
# unzip packer_0.5.1_linux_amd64.zip
Archive:  packer_0.5.1_linux_amd64.zip
  inflating: packer
  inflating: packer-builder-amazon-chroot
  inflating: packer-builder-amazon-ebs
  inflating: packer-builder-amazon-instance
  inflating: packer-builder-digitalocean
  inflating: packer-builder-docker
  inflating: packer-builder-googlecompute
  inflating: packer-builder-openstack
  inflating: packer-builder-qemu
  inflating: packer-builder-virtualbox-iso
  inflating: packer-builder-virtualbox-ovf
  inflating: packer-builder-vmware-iso
  inflating: packer-builder-vmware-vmx
  inflating: packer-command-build
  inflating: packer-command-fix
  inflating: packer-command-inspect
  inflating: packer-command-validate
  inflating: packer-post-processor-vagrant
  inflating: packer-post-processor-vsphere
  inflating: packer-provisioner-ansible-local
  inflating: packer-provisioner-chef-solo
  inflating: packer-provisioner-file
  inflating: packer-provisioner-puppet-masterless
  inflating: packer-provisioner-salt-masterless
  inflating: packer-provisioner-shell
# cd ../
# mv packer /usr/local/

3. パスを設定

パスの最初に持ってこないとうまく動かなかった。

# cd
# cp -p .bash_profile .bash_profile.org
# vi .bash_profile
パスを追加
# diff .bash_profile .bash_profile.org
10d9
< PATH=/usr/local/packer:$PATH
# exec $SHELL -l

4. 実行テスト

# packer
usage: packer [--version] [--help] <command> [<args>]

Available commands are:
    build       build image(s) from template
    fix         fixes templates from old versions of packer
    inspect     see components of a template
    validate    check that a template is valid

Globally recognized options:
    -machine-readable    Machine-readable output format.