How to Install Golang in Kali Linux

golang

Golang (Go) is a programming language that are becoming more and more popular and I have seen many interesting tools that are written in Go. Since Go are not being installed by default in Kali Linux I thought that publishing a quick-start guide could be a good idea.

  1. Start by open your web browser and visit https://golang.org/dl/
  2. Download the latest version for Linux – “gox.xx.x.linux-amd64.tar.gz”
    Download page on golang.org
  3. Open your terminal and navigate to your downloads folder
    cd /root/Downloads
  4. Extract the files
    tar -C /usr/local/ -xzf go1.13.6.linux-amd64.tar.gz
  5. Add variables for GO by modifying “~/.bashrc”
    vim ~/.bashrc
    Add the following paths to the end of the file
    export GOPATH=/root/go-workspace
    export GOROOT=/usr/local/go
    PATH=$PATH:$GOROOT/bin/:$GOPATH/bin
  6. Now we need to refresh the bashrc to get the updated variables
    source ~/.bashrc
  7. Now we just need to verify that everything is correct configured and we can do that by creating a simple ‘hello world’ program in Go.
    vim helloworld.go
    Add the following code to the file:
    package main
    import "fmt"
    func main() {
    fmt.Printf("Hello world!\n")
    }
    Then save the file and try to run the program:
    go run helloworld.go
    If everything was configured correctly you should see something like this:
    golang.helloworld
    hackerman1
    You are now ready to use Golang on your Kali Linux machine!

Copyright © 2022