Install Golang on Linux

A few simple steps to install golang

By Asaf Gur, Published 2018-11-22

Step 1 - Download From

Go to and pick the version you want to download. For your convenience, you can open a terminal and set the version you selected and set it to a variable.
For example, if I picked go1.11.2.linux-amd64.tar.gz I would do the following:

$ export GO_PKG=go1.11.2.linux-amd64.tar.gz

Now download:

$ cd ~/Downloads
$ curl "$GO_PKG" -o $GO_PKG

Step 2 - Untar The Package

Still in ~/Downloads directory:

$ sudo tar -C /usr/local -xvzf $GO_PKG

This will create a link in your /usr/local/bin dir to the go installation path:

$ sudo ln -s  /usr/local/go/bin/go /usr/local/bin/go

Step 4 - Edit .bashrc

Our last step is to set the GOPATH variable automatically.
Replace GO_WORKSPACE with your actual go workspace.
Edit .bashrc and add this:


That’s it!

You can now test your go installation.

$ go
Go is a tool for managing Go source code.


	go command [arguments]

The commands are:

	build       compile packages and dependencies
	clean       remove object files and cached files
	doc         show documentation for package or symbol
	env         print Go environment information
	bug         start a bug report
	fix         update packages to use new APIs
	fmt         gofmt (reformat) package sources
	generate    generate Go files by processing source
	get         download and install packages and dependencies
	install     compile and install packages and dependencies
	list        list packages
	run         compile and run Go program
	test        test packages
	tool        run specified go tool
	version     print Go version
	vet         report likely mistakes in packages

Use "go help [command]" for more information about a command.

Additional help topics:

	c           calling between Go and C
	buildmode   build modes
	cache       build and test caching
	filetype    file types
	gopath      GOPATH environment variable
	environment environment variables
	importpath  import path syntax
	packages    package lists
	testflag    testing flags
	testfunc    testing functions

Use "go help [topic]" for more information about that topic.