Installing Go (Golang) on Linux for Seamless Pentesting Tool Integration

Installing Go (Golang) on Linux for Seamless Pentesting Tool Integration

Golang, also known as Go, has become a popular programming language for creating powerful tools, especially in areas like penetration testing. However, setting up Go on Linux Systems, particularly those without pre-installed Go, can be tricky. This guide simplifies the process, providing a straightforward way to configure Go on VPS running Debian-based Linux platforms. By following these steps, you'll seamlessly integrate Go into your system, unlocking a variety of pentesting tools developed in Go.

Identify System Architecture

Note: Before proceeding with the installation of Golang on your system, it's crucial to verify your system architecture. You can do this by running either of the following commands in your terminal:

uname -a
# OR 
dpkg --print-architecture

These commands will provide information about your system's architecture, such as "amd64" or "arm64".

Once you've identified your system architecture, download the specific Golang package corresponding to your architecture from the official Golang download page Choosing the correct package ensures a seamless installation process tailored to your system, enhancing the overall compatibility and performance of Golang on your machine.

Download Go

Visit -

Download the latest Linux version, usually in the format "gox.xx.x.linux-amd64.tar.gz."

Copy the Link and In the terminal type wget <copied link>


Access Your Downloads Folder:

If you've downloaded a file from a web browser and need to navigate to the downloads folder, you can typically do this through the terminal using the cd (change directory) command.

cd /path/to/your/downloads

Setup Go

Extract Go Files:

Execute the following command to extract the downloaded files:

sudo tar -C /usr/local/ -xzf go1.21.4.linux-amd64.tar.gz 
# Change filename accordingly which is downloaded

Note: To determine your system's current shell type, execute the following command:

echo $0

This command will display the currently running shell, such as "bash" or "zsh"

If your current shell is zsh, the configuration file will be different accordingly. Open your shell configuration file for editing using the following command:

# For bash:
nano ~/.bashrc

# For zsh:
nano ~/.zshrc

Afterwards, append the following lines at the end of the file to set up the necessary environment variables.

export GOPATH=$HOME/go-workspace
export GOROOT=/usr/local/go

To save your changes, press CTRL+X, followed by Y.

Restart the Shell:

exec $SHELL

Verify Your Go Installation

go version

By default, Go does not enforce a single, centralized workspace for all users on a system. Each user typically maintains their own workspace for Go development. The location of this workspace is determined by the GOPATH environment variable.

The root user, being a different user, would need to set up their Go workspace separately if they intend to work with Go projects.

Installing via Automated Script

If you prefer a hassle-free approach, I've crafted an automated shell script that streamlines the entire process. This script not only downloads the latest Go package but also takes care of extraction and sets up the necessary environment variables based on the detected shell.

No need to manually intervene or configure settings – simply run the script, and it will handle everything for you, ensuring a swift and seamless Go installation experience.

chmod +x

Uninstalling Go

If the Go is already installed on your system, and for some reason, you want to uninstall that, you can follow the below steps.

rm -rf $(which go)
# OR
sudo apt-get remove golang-go
sudo apt-get remove --auto-remove golang-go

Did you find this article valuable?

Support BreachForce by becoming a sponsor. Any amount is appreciated!