- Download it from https://golang.org/dl/
1 | $ curl -sSL https: //golang .org /dl/goX .XX.X.linux-amd64. tar .gz -o goX.XX.X.linux-amd64. tar .gz |
replace the X.XX.X with current version.
- Extract the downloaded file to
/usr/local
1 | $ sudo tar -C /usr/local -xzf goX.XX.X.linux-amd64. tar .gz |
- Add the path
/usr/local/go/bin
to the environment variable, and for that just add the below lines to your .bashrc file, which is located on your home directory~/.bashrc
. Add below lines
1 2 3 | export GOROOT= /usr/local/go export GOPATH=$HOME /go export PATH=$GOPATH /bin :$GOROOT /bin :$PATH |
and now you are good to GO {he he !!}. Test the setup with go version
1 2 | $ go version go version go1.15.3 linux /amd64 |
thats it.