December 6, 2017 How to install Go on Ubuntu


Download Go archive from official web site You need Linux archive. For example go1.9.2.linux-amd64.tar.gz

Unpack archive to your /usr/local/go folder

tar -C /usr/local -xzf go1.9.2.linux-amd64.tar.gz

Edit your shell environment login file. ~/.zshrc if you use Z shell or ~/.bashrc if you use Bash. These files run with your shell startup. Put next environment variables there

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GOBIN=$HOME/go/bin
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

Make sure that you have go/bin and go/src folders inside your home directory:

mkdir -p ~/go/bin
mkdir -p ~/go/src

Activate your environment variables

in case if you use bash

source ~/.zshrc

in case if you use Z shel

source ~/.zshrc