In this age of growing computer power breaking codes which used to take years or hundred of years now take hours or days to crack. With the advent of the quantum computer, the situation is only going to get worse.
In this blog, I will tell you how to set up a Vault to keep your emails and passwords safe. This value can easily be set up and if you are working in an environment with sensitive data then you need to set up a vault is much more than anyone else.
Now, without any more delay let’s get started.
Compiling from Source
To compile from source, you will need Go installed and configured properly (including a GOPATH environment variable set), as well as a copy of git in your PATH.
Step 1 — Install Go Language
Login to your Ubuntu system using ssh and upgrade to apply latest security updates there.
$ sudo apt-get update $ sudo apt-get -y upgrade
Now download the Go language binary archive file using following link.
$ wget https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz $ wget https://storage.googleapis.com/golang/go1.9.2.linux-amd64.tar.gz
Now extract the downloaded archive and install it to the desired location on the system. For this tutorial, I am installing it under /usr/local directory. You can also put this under the home
directory (for shared hosting) or other location.
$ sudo tar -xvf go1.8.3.linux-amd64.tar.gz $ sudo mv go /usr/local
Step 2 — Setup Go Environment
Now you need to setup Go language environment variables for your project. Commonly you need to set 3 environment variables as GOROOT, GOPATH and PATH.
GOROOT is the location where Go package is installed on your system.
$ export GOROOT=/usr/local/go
GOPATH is the location of your work directory. For example my project directory is:
~/Projects/Proj1 $ export GOPATH=$HOME/Projects/Proj1
Now set the PATH variable to access go binary system wide.
$ export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
All above environment will be set for your current session only. To make it permanent add above commands in ~/.profile file.
Also add the above mentioned PATHS into ~/.baschrc file, so that it will keep on picking the path automatically.
$ vim ~/.bashrc
Add the following lines on last line of this file:
export GOROOT=/usr/local/go export GOPATH=$HOME/Projects/Proj1 export PATH=$GOPATH/bin:$GOROOT/bin:$PATH export VAULT_ADDR=http://127.0.0.1:8200
Step 3 — Verify Installation
At this step, you have successfully installed and configured go language on your system. First use the following command to check Go version.
$ go version go version go1.8.3 linux/amd64
Now also verify all configured environment variables using following command.
$ go env
$ sudo apt-get install git
- Clone the Vault repository from GitHub into your GOPATH:
$ mkdir -p $GOPATH/src/github.com/hashicorp && cd $! $ git clone https://github.com/hashicorp/vault.git $ cd vault
- Bootstrap the project. This will download and compile libraries and tools needed to compile Vault:
$ make bootstrap
- Build Vault for your current system and put the binary in ./bin/ (relative to the git checkout). The make dev target is just a shortcut that builds vault for only your local build environment (no cross-compiled targets).
$ make dev
Verifying the Installation
To verify Vault is properly installed, run vault -v on your system. You should see help output. If you are executing it from the command line, make sure it is on your PATH or you may get an error about Vault not being found.
$ vault -v
The procedure is not as difficult as it looks. Once you know your way around things just keep getting easier.