How to install the current version of Go in Ubuntu Precise

前端 未结 17 2058
温柔的废话
温柔的废话 2021-01-29 19:08

Running sudo apt-get install golang-stable, I get Go version go1.0.3. Is there any way to install go1.1.1?

17条回答
  •  独厮守ぢ
    2021-01-29 19:24

    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.

提交回复
热议问题