Download page: https://golang.org/dl/
wget https://dl.google.com/go/go1.11.4.linux-amd64.tar.gz
tar zxvf go1.11.4.linux-amd64.tar.gz -C /etc
-
GOROOT
: Location ofgo
tools binary distributions. In the previous step, we have installedgo
at/etc/go
directory. -
PATH
:$GOROOT/bin
-
GOPATH
: Location of workspace. For this tutorial, we will create a workspace at$HOME/go_workspace/go
directory.
For active session
export GOROOT=/etc/go
export PATH=$PATH:$GOROOT/bin
export GOPATH=$HOME/go_workspace/go
Automatically set Environment_Variables
every time physical machine is powered on
echo 'export GOROOT=/etc/go' >> $HOME/.profile
echo 'export PATH=$PATH:$GOROOT/bin' >> $HOME/.profile
echo 'export GOPATH=$HOME/go_workspace/go' >> $HOME/.profile
Verify: go version