How to install the stable version of Go on Kali Linux

Hey, I'm a postgraduate in Cyber Security with practical experience in Software Engineering and DevOps Operations. The top player on TryHackMe platform, multilingual speaker (Kazakh, Russian, English, Spanish, and Turkish), curios person, bookworm, geek, sports lover, and just a good guy to speak with!
Check if you already have installed Go on your machine:
- Check:
Output can be:which go/usr/local/go/bin/go # OR /usr/bin/go - Remove the Golang binary:
sudo rm -rvf [path_to_go_binary] sudo rm -rvf /usr/local/go/ - Remove the Go bin directory from your PATH environment variable. Remove any reference on
$GOPATHor$PATHexport definitions in your.zprofileand.zshrc:vim ~/.zprofile vim ~/.zshrc
Install Go on Kali Linux:
- To install Go visit the following address: https://golang.org/dl/
- Download archive for Linux platform:

- Untar archive to the
/usr/local/path:tar -C /usr/local/ -xzf go1.17.7.linux-amd64.tar.gz-C- option is used to specify a different directory other than the current working directory-x- is one of the mandatory options (-c,-t,-x) which specifies the command to extract the file from an archive-z- optional flag, which specifies to filter the archive file through gzip. This flag is used to extract files from compressed archives. In our case, we are downloading the.tar.gzarchive-f- option specifies the filetarcommand is going to work with - Open
.zshrcfile:vim ~/.zshrc - Go down to the end of the file and add the following entries for Go variables and Go path:
Here we're specifying Go workspace at:# Go variables and path export GOPATH=/root/go-workspace export GOROOT=/usr/local/go PATH=$PATH:$GOROOT/bin/:$GOPATH/bin/root/go-workspace - Save and close the file
- Refresh zsh configuration with:
source ~/.zshrc - Now check installed version of Go:
go version
Reference
- Uninstalling Go
- How to uninstall Golang in 3 easy steps via terminal
- How to uninstall Go?
- How do I use the tar command?
- Order of execution and purpose of .profile vs .zshrc
- Tar command options and syntax explained
- What does the -f parameter do in the tar command
- How to Extract Tar Files to Specific or Different Directory in Linux





