Install go

Last updated:

GOLINUX
  1. Download tar file from https://go.dev/doc/install
  2. Create /usr/local/go if fresh install.
  3. Remove any previous Go installation by deleting the /usr/local/go folder (if it exists), then extract the archive you just downloaded into /usr/local, creating a fresh Go tree in /usr/local/go:
## Existing install
$ sudo rm -rf /usr/local/go && tar -C /usr/local -xzf go1.18.2.linux-amd64.tar.gz

## New install
$ sudo tar -C /usr/local -xzf go1.18.2.linux-amd64.tar.gz
  1. Add /usr/local/go/bin to the PATH environment variable.Both /etc/profile and /etc/bashrc
export PATH=$PATH:/usr/local/go/bin
  1. Verify that you’ve installed Go by opening a command prompt and typing the following command:
$ go version
go version go1.18.2 linux/amd64

references:

  1. go install