-
Download the Latest Go Binary from https://go.dev/dl/
wget https://go.dev/dl/go1.24.2.linux-amd64.tar.gz -
Remove any existing Go installation (if necessary)
sudo rm -rf /usr/local/go -
Extract the downloaded tarball to /usr/local:
sudo tar -C /usr/local -xzf go1.24.2.linux-amd64.tar.gz -
Add Go’s binary path to your PATH and set the GOPATH environment variable by editing your shell configuration file (e.g., ~/.bashrc or ~/.zshrc):
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc echo 'export GOPATH=$HOME/go' >> ~/.bashrc -
Apply the changes:
source ~/.bashrc -
Check the installed Go version:
go version -
Remove the downloaded tarball:
rm go1.24.2.linux-amd64.tar.gz -
OPTIONAL: Create directories for your Go workspace:
`mkdir -p $HOME/go/{bin,src,pkg}