Skip to content

Instantly share code, notes, and snippets.

@fedir
Forked from missinglink/go-ubuntu-install.md
Last active October 21, 2017 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedir/530bfcc8edd70e2809e5128b9d92422b to your computer and use it in GitHub Desktop.
Save fedir/530bfcc8edd70e2809e5128b9d92422b to your computer and use it in GitHub Desktop.
Install go on ubuntu
sudo add-apt-repository ppa:masterminds/glide && sudo apt-get update
sudo apt-get install glide

note: always check for the latest versions, the version numbers shown here will fall out of date quickly.

Installing Go on Ubuntu:

Step 1. Grab yourself a binary release from here: https://golang.org/dl/

You'll want to use one from the Stable versions, you probably want one which is in bold, for Ubuntu it's xxx-linux-amd64.tar.gz

wget https://storage.googleapis.com/golang/go1.9.1.linux-amd64.tar.gz;

Step 2. Install

sudo tar -C /usr/local -xzf go1.9.1.linux-amd64.tar.gz;

Step 3. Decide where your packages will live

unless your name is also peter you might want to change that bit!

mkdir /home/fedir/.go;

Step 4. Configure Environment

On Ubuntu you can edit ~/.bashrc to set your PATH, at the bottom add:

change the path below to match the one you created in step 3!

# The go binary, so we can actually run it
export PATH=$PATH:/usr/local/go/bin;

# This is where all your go packages live
GOPATH=/home/fedir/.go;
export GOPATH;

# Add GOPATH/bin so compiled go libs appear on your PATH
export PATH=$PATH:$GOPATH/bin;

Step 5. Run that script

Every new terminal will run the above scripts when it starts; to apply it to the current terminal window we just:

source ~/.bashrc

Step 6. Test

$ go version
go version go1.9.1 linux/amd64

Full install instructions can be found here: https://golang.org/doc/install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment