Skip to content

Instantly share code, notes, and snippets.

@hawkup
Last active August 10, 2018 03:56
Show Gist options
  • Save hawkup/dae817eb0110cf8d5702 to your computer and use it in GitHub Desktop.
Save hawkup/dae817eb0110cf8d5702 to your computer and use it in GitHub Desktop.
Installing Golang on ubuntu 14.04

First install gvm

  • install curl
sudo apt-get install curl
  • install git latest version
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
  • install bison
sudo apt-get install bison
  • install make
sudo apt-get install make
  • clone repo and add to user directory
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
  • open ~/.bashrc and source gvm directory
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
  • check gvm version
gvm version
  • list install available
gvm listall

Second install go

  • install go (this example install version 1.4.2)
gvm install go1.4.2
  • tell gvm to use go
gvm use go1.4.2
  • check go version
go version

Reference: http://www.hostingadvice.com/how-to/install-golang-on-ubuntu/

  • Other method
sudo add-apt-repository -y ppa:evarlast/golang1.4
sudo apt-get update
sudo apt-get install -y golang
  • SET $GOPATH
mkdir ~/.go
echo "GOPATH=$HOME/.go" >> ~/.bashrc
echo "export GOPATH" >> ~/.bashrc
echo "PATH=\$PATH:\$GOPATH/bin # Add GOPATH/bin to PATH for scripting" >> ~/.bashrc
source ~/.bashrc
  • create Project
mkdir -p $GOPATH/src/github.com/user
mkdir ~/hello-go
ln -s ~/hello-go ~/.go/src/github.com/user/hello-go

reference: https://larry-price.com/blog/2013/12/15/setting-up-a-go-environment-in-ubuntu-12-dot-04

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