How to Install Golang on Ubuntu

Hey! If you love Go and building Go apps as much as I do, let's connect on Twitter or LinkedIn. I talk about this stuff all the time!

Want to learn how to build better Go applications faster and easier? You can.

Check out my course on the Go Standard Library. You can check it out now for free.


If you want to install Go on Ubuntu, it’s very easy.

  1. Download the latest stable release of Go from the official website.
  2. Extract the downloaded tarball using the following command:
tar -xvf go1.x.x.linux-amd64.tar.gz

Replace x.x with the actual version number of Go.

  1. Move the extracted directory to the desired location. You should place it in /usr/local, so all users on the system can use Go.
sudo mv go /usr/local
  1. Add the Go bin directory to your PATH environment variable. Open your ~/.profile file and add the following line at the end:
export PATH=$PATH:/usr/local/go/bin
  1. Reload your ~/.profile file to apply the changes:
source ~/.profile
  1. Verify the installation by checking the Go version:
go version

This should print the installed version of Go.

You may also want to set up your Go workspace by defining the GOPATH environment variable. The GOPATH variable specifies the location of your Go workspace, where your Go source code and libraries are stored.

By default, the go command will look for packages in the $GOPATH/src directory and will store the compiled binaries in the $GOPATH/bin directory.

To set the GOPATH variable, open your ~/.profile file and add this line:

export GOPATH=$HOME/go

Replace $HOME/go with the desired location of your Go workspace.

Don’t forget to reload the ~/.profile file to apply the changes:

source ~/.profile

That’s it! You now have Go installed on your Ubuntu system.


Questions or comments? Reach out to me


Learn how to leverage the Go Standard Library like a PRO.

I just created a new course, The Go Standard Library, check it out!