确认系统已经安装了go,version 1.10.1+
[root@node2 ~]# tar -C /usr/local -xzf go1.10.3.linux-amd64.tar.gz
- 配置GOPATH:
[root@node2 ~]# mkdir /app/go_path
[root@node2 ~]# export GOPATH=/app/go_path
- 下载vault的安装包
[root@node2 ~]# mkdir -p $GOPATH/src/github.com/hashicorp && cd $_
[root@node2 hashicorp]# git clone https://github.com/hashicorp/vault.git
- 编译:
[root@node2 hashicorp]# cd vault/
[root@node2 vault]# make bootstrap
- 配置环境变量并编译:
echo "PATH=$PATH:/usr/local/go/bin:/app/go_path/bin" >>/root/.bash_profile
export PATH=$PATH:/usr/local/go/bin:/app/go_path/bin
[root@node2 vault]# make dev
安装完成后会生成vault执行文件:
[root@node2 bin]# pwd
/app/go_path/src/github.com/hashicorp/vault/bin
[root@node2 bin]# ll
total 93672
-rwxr-xr-x 1 root root 95916982 Aug 13 17:30 vault
[root@node2 bin]# ./vault help
Usage: vault <command> [args]
Common commands:
read Read data and retrieves secrets
write Write data, configuration, and secrets
delete Delete secrets and configuration
list List data or secrets
login Authenticate locally
agent Start a Vault agent
server Start a Vault server
status Print seal and HA status
unwrap Unwrap a wrapped secret
Other commands:
audit Interact with audit devices
auth Interact with auth methods
kv Interact with Vault's Key-Value storage
lease Interact with leases
namespace Interact with namespaces
operator Perform operator-specific tasks
path-help Retrieve API help for paths
plugin Interact with Vault plugins and catalog
policy Interact with policies
secrets Interact with secrets engines
ssh Initiate an SSH session
token Interact with tokens