Install Go 1.11 on Ubuntu 18.04 & 16.04 LTS

Take advantage of much needed tools and components

Image for post

Go 1.11 was released on August 24th, 2018 and has introduced a few really needed tools and components. This includes versioned modules, experimental WebAssembly support, debugging improvements, and minor changes to core packages and performance/run-time.

This piece will walk through installing Go 1.11 on your Ubuntu 18.04 LTS, 16.04 LTS, and 14.04 LTS systems.

1. Install Go language

Upgrade to apply the latest security updates on Ubuntu.

sudo apt-get updatesudo apt-get -y upgrade

You need to download the Go binary file. You can find the list of download links as per OS and architecture from their official package. To install it on Ubuntu 64-bit OS, hit the following commands:

cd /tmpwget https://dl.google.com/go/go1.11.linux-amd64.tar.gz

Now, extract the downloaded archive and install it to the desired location on the system. I generally keep it under /usr/local directory as suggested by standards.

sudo tar -xvf go1.11.linux-amd64.tar.gzsudo mv go /usr/local

2. Set up Go environment

Now, let?s set up Go language environment variables GOROOT , GOPATH and PATH.

GOROOT is the location where the Go package is installed on your system.

GOPATH is the location of your work directory. For example, here directory is ~/go .

Open your .profile file and add a global variable at the end of the file. You may want to add this into a .zshrc or.bashrc file as per your shell configuration.

export GOROOT=/usr/local/goexport GOPATH=$HOME/goexport PATH=$GOPATH/bin:$GOROOT/bin:$PATH

3 . Update current shell session

source ~/.profile

This will allow you to use go commands without restarting your terminal.

4. Verify installation

You have successfully installed and configured Go language on your system.

To check Go version:

go version// go version go1.11 linux/amd64

Now, also verify all configured environment variables using the following command:

You have successfully installed Go 1.11. You can now make some cool stuff with Go.

23