Installing Go on Debian

 

1.   Download go tar file from https://golang.org/dl/

wget https://dl.google.com/go/go1.11.1.linux-amd64.tar.gz

2.    untar the file

tar -xzvf go1.11.1.linux-amd64.tar.gz

3.  Move the go folder to installation directory, here I am moving it to /usr/local

mv go /usr/local

4.  Set the path

export GOROOT=/usr/local/go
export PATH=$GOROOT/bin:$PATH

We can add the above entries in ~/.profile file to make it permanent.

5.  Verify the installation

$ go version
go version go1.11.1 linux/amd64
# go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build056142857=/tmp/go-build -gno-record-gcc-switches"

Leave a Reply

Your email address will not be published. Required fields are marked *