Download Golang
Download the latest Go binary from the official website:
https://go.dev/dl/For example, to download Go 1.24.1:
wget https://go.dev/dl/go1.24.1.linux-amd64.tar.gzRemove Existing Go Installation (If Any)
If you have an older version of Go installed, remove it before proceeding:
sudo rm -rf /usr/local/goExtract and Install Go
Extract the downloaded archive to /usr/local/:
sudo tar -C /usr/local -xzf go1.24.1.linux-amd64.tar.gzNote: Do not extract into an existing /usr/local/go directory as it may cause installation issues.
Set Up Environment Variables
To use Go globally, add it to your PATH by modifying the profile file.
For user-specific installation, update ~/.bashrc:
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrcVerify Installation
Run the following command to check the installed version of Go:
go versionExpected output (example):
go version go1.24.1 linux/amd64