How to install the current version of Go in Ubuntu Precise
Running sudo apt-get install golang-stable
, I get Go version go1.0.3
. Is there any way to install go1.1.1
?
Solution 1:
[Updated (previous answer no longer applied)]
For fetching the latest version:
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt update
sudo apt install golang-go
Also see the wiki
Solution 2:
I like to use GVM for managing my Go versions in my Ubuntu box. Pretty simple to use, and if you're familiar with RVM, it's a nobrainer. It allows you to have multiple versions of Go installed in your system and switch between whichever version you want at any point in time.
Install GVM with:
sudo apt-get install bison mercurial
bash < <(curl -LSs 'https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer')
. "$HOME/.gvm/scripts/gvm"
and then it's as easy as doing this:
gvm install go1.1.1
gvm use go1.1.1 --default
The default flag at the end of the second command will set go1.1.1 to be your default Go version whenever you start a new terminal session.