Skip to content

Installing Go

kaziczeriy edited this page Sep 30, 2018 · 1 revision

wiki/Installing-Go

Windows

Download and run the installer found at http://golang.org/doc/install

OS X

Download an install the darwin binary from https://golang.org/dl/

You can also install go using the Homebrew package manager.

Linux

Ubuntu

The Ubuntu repositories carry an old version of Go.

Ubuntu users can use the 'gophers' PPA to install an up to date version of Go (version 1.7 or later is

preferred). See https://launchpad.net/~gophers/+archive/ubuntu/archive for more information. Note

that this PPA requires adding /usr/lib/go-1.X/bin to the executable PATH.

Other distros

Download the stable distribution, go1.10.X is supported , go.1.11,X is not supported yet

curl -O https://dl.google.com/go/go1.10.4.linux-amd64.tar.gz

Unpack it to the /usr/local (might require sudo)

tar -C /usr/local -xzf go1.10.4.linux-amd64.tar.gz

Set GOPATH and PATH

For Go to work properly, you need to set the following two environment variables:

  1. Setup a go folder mkdir -p ~/go; echo "export GOPATH=$HOME/go" >> ~/.bashrc
  2. Update your path echo "export PATH=$PATH:$HOME/go/bin:/usr/local/go/bin" >> ~/.bashrc
  3. Read the environment variables into current session: source ~/.bashrc