Packages / golang / Ubuntu 22.04
Install guide · Ubuntu 22.04 (jammy)printed 28 Oct 2026, 07:20 UTC
Install Go 1.27 on Ubuntu 22.04
Ubuntu 22.04 ships Go 1.18. The current release is 1.27.3. freshdeb builds it for jammy from upstream's release with Debian's packaging, so it replaces the distribution's package in place and updates with apt upgrade like the rest of the system.
- Ubuntu 22.04 ships
- 1.182:1.18~0ubuntu2
- v1.27
- 1.27.3stays on 1.27.x, patch releases only. Currently 1.27.3, upstream support until Aug 2027.
- v1.26
- 1.26.10stays on 1.26.x, patch releases only. Currently 1.26.10, upstream support until Feb 2027.
- Built for
- amd64 and arm64, natively
Not published yet. The first golang release is being built. These commands work once it lands; the version shown is the one it will publish.
1Trust the signing key (once per machine)
sudo install -d -m 0755 /etc/apt/keyrings curl -fsSL https://deb.freshdeb.com/freshdeb-archive-keyring.gpg \ | sudo tee /etc/apt/keyrings/freshdeb-archive-keyring.gpg >/dev/null
Fingerprint 3BBD F03A 9C0B F890 F8CA 9510 7595 CC55 468F 3161. How to verify.
2Add the source for jammy
sudo tee /etc/apt/sources.list.d/freshdeb-golang.sources >/dev/null <<EOF Types: deb URIs: https://deb.freshdeb.com/golang Suites: jammy Components: latest Signed-By: /etc/apt/keyrings/freshdeb-archive-keyring.gpg EOF
latest mirrors v1.27, currently 1.27.3, and moves when a newer line takes over. Other components: v1.27, v1.26, listed with the versions.
3Install
sudo apt update && sudo apt install golang-go
apt policy golang-go # expect 2:1.27.3-1+freshdeb~ubuntu22.04Already on Ubuntu 22.04's Go? The same command upgrades it: the freshdeb version sorts higher. What's different from Debian's package.
Upgrading from Go 1.18
What changed between Ubuntu 22.04's 1.18 and 1.27.3 that you may notice. Configuration and data stay where Debian put them.
- Since 1.21
- The
goline in go.mod is a minimum: a module that asks for a newer Go makesgodownload and run that toolchain (GOTOOLCHAIN=auto, the default), or stop with an error underGOTOOLCHAIN=local. - Since 1.22
- Each loop iteration gets its own loop variable, in modules whose go.mod says
go 1.22or later. Modules declaring an older Go keep the old behaviour. - Also
golang-gomakes this Go/usr/bin/go. The distribution's versioned Go packages (golang-1.24-goand the like) stay installed untilapt autoremove, and code that built with them builds with this Go: Go 1 programs stay compatible.
Going back to 1.18
Delete /etc/apt/sources.list.d/freshdeb-golang.sources, run sudo apt update, then sudo apt install golang-go=2:1.18~0ubuntu2: apt asks before it downgrades. Name the other golang packages you installed with their Ubuntu 22.04 version too.
Why a package
The tarball from go.dev in /usr/local/go is the same Go, but it needs PATH set and updating by hand. As a package, /usr/bin/go is this Go and apt upgrade brings its security releases. Each supported minor is its own line, so v1.26 stays on 1.26.