How to install golang (go) >1.21 in Ubuntu with Snap

Install golang in a somewhat recent version in Ubuntu is quite annoying. Here a on-line command which will do the trick for you. (Replace 1.21 with whatever version of go you want to install)

sudo apt remove --autoremove golang-go; sudo apt install snapd; sudo snap install --classic --channel=1.21/stable go

What it does:

  1. sudo apt remove --autoremove golang-go Remove all current go installation you installed via apt
  2. sudo apt install snapd; Install snap (Software packaging system by Canonical <= Folks behind ubuntu. Learn more)
  3. sudo snap install --classic --channel=1.21/stable go Use snap to install golang

This works like a charm, and after hours of trying to make it work via the binary download “official” way mentioned on the golang.org this finally made my golang installation work.

Highly skilled DevOps/SRE Freelancer

I am Simon, the author of this blog. And I have great news: You can work with me

As DevOps and Infrastructure freelancer, I will help you choose the right Infrastructure technology for your company, fix your cloud problems and support your team in building scalable products.

I work with Golang, Docker, Kubernetes, Google Cloud, AWS and Terraform.

Checkout my website simon-frey.com to learn more or directly contact me via the button below.

Simon Frey Header image
Let’s work together!
To never miss an article subscribe to my newsletter
No ads. One click unsubscribe.