How to install the current version of Go in Ubuntu Precise

前端 未结 17 1905
温柔的废话
温柔的废话 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:21

    [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

    0 讨论(0)
  • 2021-01-29 19:22

    If someone is looking for installing Go 1.8 the follow this:

    sudo add-apt-repository ppa:longsleep/golang-backports
    sudo apt-get update
    sudo apt-get install golang-go
    

    And then install go

    sudo apt-get install golang-1.8-go
    
    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-01-29 19:25

    On recent Ubuntu (20.10) sudo apt-get install golang works fine; it will install version 1.14.

    0 讨论(0)
  • 2021-01-29 19:27

    These days according to the golang github with for Ubuntu, it's possible to install the latest version of Go easily via a snap:

    Using snaps also works quite well:

    # This will give you the latest version of go
    $ sudo snap install --classic go
    

    Potentially preferable to fussing with outdated and/or 3rd party PPAs

    0 讨论(0)
  • 2021-01-29 19:28

    You can also use the update-golang script:

    update-golang is a script to easily fetch and install new Golang releases with minimum system intrusion

    git clone https://github.com/udhos/update-golang
    cd update-golang
    sudo ./update-golang.sh
    
    0 讨论(0)
提交回复
热议问题