Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installing Go with command line

NOTE: This is heavily outdated Gist snippet from 2017.


Install Go language with a Bash script

Another alternative to installing Go is to use a simple Bash script. It will download and install Go language under of your own user account.

Note that a system-wide installation might be better for some things (for example, better protected from accidental modifications etc.), but this was a bit simpler to setup.

For this example, we are using:

Create directory

mkdir -p ~/git/GitHub/canha

Clone Git repository

cd ~/git/GitHub/canha
git clone https://github.com/canha/golang-tools-install-script 
cd golang-tools-install-script/

Install a 64-bit version

bash goinstall.sh --64

Script downloads the version specified in the Bash script (at the moment 1.9.2) and installs it to ~/.go directory.

Check that it was added to your shell config

cat ~/.bashrc

Reload your shell

source ~/.bashrc

Try if it works

go help

That should show a quick help for the go command.

Installing Go to Ubuntu Linux

Install gvm

Install required packages for gvm

sudo apt-get install curl git mercurial make binutils bison gcc build-essential

Install old Go version first

gvm install go1.4 -B
gvm use go1.4
export GOROOT_BOOTSTRAP=$GOROOT

Look what is the latest Go version

Now after installing the old version, look for the latest release.

  • Open URL https://golang.org/dl/ and look what is the latest version number.
  • Then look if that release is available via gvm:
    • gvm listall
  • Install latest version
    • gvm install go1.8.3
  • Set it as the default version:
    • gvm use go1.8.3 --default

Updating to a new version

If you have previous version of Go already installed, you can update to a new release version of Go with these steps:

  • gvm install go1.8.3
  • gvm use go1.8.3 --default
@LIP17

This comment has been minimized.

Copy link

@LIP17 LIP17 commented Aug 2, 2017

It is useful, thank you!

@natrod

This comment has been minimized.

Copy link

@natrod natrod commented Dec 11, 2017

This is exactly what i was looking for thanks :)

@Sanix-Darker

This comment has been minimized.

Copy link

@Sanix-Darker Sanix-Darker commented Dec 17, 2019

sudo apt-get install golang works for me as well !
Am on Ubuntu !

@d2s

This comment has been minimized.

Copy link
Owner Author

@d2s d2s commented Dec 17, 2019

@Sanix-Darker, agreed, this snippet is from 2017 and would most likely do things differently these days.

@giacomovalenti

This comment has been minimized.

Copy link

@giacomovalenti giacomovalenti commented Apr 5, 2020

Not working anymore ARMv7 binaries no longer available on storage.googleapis.com

@d2s

This comment has been minimized.

Copy link
Owner Author

@d2s d2s commented Apr 5, 2020

Yeah, this Gist is last modified on Dec 29, 2017.

@therealnoobnoob01

This comment has been minimized.

Copy link

@therealnoobnoob01 therealnoobnoob01 commented May 6, 2020

give us a kali linux 2020.1 install guid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.