Install Golang/Go smoothly in ubuntu/debian based operating systems for bug bounty and beyong. Lets destroy those silly errors forever!
Hello! Lets jump into the topic shall we ? Go-language comes pre-installed in some linux distros such as kali, parrot etc. but the problem is , the installed go-lang version is old and does not come in much use and thus we have to install a newer version and this is where weird problems aka errors pops up : ( I will guide you today with extremely easy steps so that you can start your journey with GO right away !
Lets roll in :
1. First of all just paste this command in your terminal and hit enter.
sudo apt-get remove --auto-remove golang
In case your system had any golang installation it will be uninstalled right away and will not cause any problems later.
NOTE: If you have tried installing golang earlier manually but failed please do delete all the changes you have made in the .bashrc file as well as the folders that you might have created in /usr/local/ related to golang .If not done so errors might popup : (
2. Go to this link and download the .tar.gz go file (linux/amd64) of version go1.17.4 or higher .
3. After downloading the file , in your terminal go to the directory where the downloaded file is located . After that paste this command and hit enter so as to extract the files from the tar.gz file :
sudo tar -C /usr/local/ -xzf <full name of go file you just downloaded>
4. Open the bashrc file by typing :
nano ~/.bashrc
5. Scroll to the bottom of the .bashrc file and paste the following :
export GOROOT=/usr/local/go
export GOPATH=$HOME/Go-Workspace
export PATH=$PATH:$GOROOT/bin:$GOPATH/tools
Press ctrl + S to save the file and ctrl + x to exit .
6. Refresh the .bashrc file to update the changes :
source ~/.bashrc
7. Now just type go version in your terminal and hopefully the go version should get displayed : )
Note that you don't need to be root in order to use go now. You can do all the stuff - (installing go-tools , running go-tools , running go programs etc) as the normal user.
helpful
ReplyDelete