http://vaultproject.io/downloads.html
ここに、
- Linux(32bit/64bit/ARM)
- MacOS X (32bit/64bit)
- Windows(32bit/64bit)
があるので、適当なものを選んでダウンロード。
zip ファイルですが、解凍すると、1ファイルだけ。
$ unzip vault_0.1.0_darwin_amd64.zip
Archive: vault_0.1.0_darwin_amd64.zip
inflating: vault
$ ls
vault
他にも、ソースコードからコンパイルするでも可。
コンパイルするときは、vault repository を Cloneしてコードを取得
$ git clone https://github.com/hashicorp/vault
Cloning into 'vault'...
remote: Counting objects: 6468, done.
remote: Compressing objects: 100% (97/97), done.
remote: Total 6468 (delta 49), reused 0 (delta 0), pack-reused 6371
Receiving objects: 100% (6468/6468), 2.55 MiB | 1.37 MiB/s, done.
Resolving deltas: 100% (3993/3993), done.
Checking connectivity... done.
で、make dev
$ make dev
go generate ./...
> Getting dependencies...> Removing old directory...
> Building...> Results:
Number of parallel builds: 8
--> darwin/amd64: github.com/hashicorp/vault
total 27288
-rwxr-xr-x 1 kunitake staff 13M 4 30 10:19 vault
$GOPATHは、
$GOPATH/src/github.com/hashicorp/vault/main.go
となるように設定しておきます。
もし、Goのコンパイラを入れてないなら
https://golang.org/dl/
あたりからダウンロード & インストール。
ちなみに、gox が使われているので、もしインストールしていなければ、それも入れておきましょう。クロスコンパイルを楽にするツールです。
$ go get github.com/mitchellh/gox
$GOPATH/bin 以下にインストールされます。
$ sudo gox -build-toolchain
Password:
The toolchain build can't be parallelized because compiling a single
Go source directory can only be done for one platform at a time. Therefore,
the toolchain for each platform will be built one at a time.
--> Toolchain: darwin/386
--> Toolchain: darwin/amd64
--> Toolchain: linux/386
--> Toolchain: linux/amd64
--> Toolchain: linux/arm
--> Toolchain: freebsd/386
--> Toolchain: freebsd/amd64
--> Toolchain: openbsd/386
--> Toolchain: openbsd/amd64
--> Toolchain: windows/386
--> Toolchain: windows/amd64
--> Toolchain: freebsd/arm
--> Toolchain: netbsd/386
--> Toolchain: netbsd/amd64
--> Toolchain: netbsd/arm
--> Toolchain: plan9/386
これで make すると普通に、自分の環境のものがコンパイルされます。
$ make dev
go generate ./...
> Getting dependencies...> Removing old directory...
> Building...> Results:
Number of parallel builds: 8
--> darwin/amd64: github.com/hashicorp/vault
total 27288
-rwxr-xr-x 1 kunitake staff 13M 4 30 15:15 vault
gox は、クロスコンパイル用のツールなので
$ gox --osarch "linux/amd64"
Number of parallel builds: 8
--> linux/amd64: github.com/hashicorp/vault
$ file vault_linux_amd64
vault_linux_amd64: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
みたいに、Linux 用の vault も、コンパイル可能です。
IPv4/IPv6 meter |
思ったより安い……時もある、Amazon |