Go (Golang) is Debian’s preferred name for the golang-* packages in main. The metapackage golang-go installs the gc compiler, linker, and standard library—enough to go build and go run on servers and workstations. When Debian’s version lags your go.mod go directive, install the official .tar.gz from go.dev.
This guide covers install Go on Debian for Debian 11 (Bullseye), 12 (Bookworm), and 13 (Trixie): apt install golang-go, the upstream tarball, PATH / GOPATH, go mod, optional gccgo, update, and uninstall. I ran these steps on Debian 13 and kept real terminal output below. Ubuntu-specific notes live in install Go on Ubuntu.
Tested on: Debian 13 (trixie); kernel 6.12.94+deb13-amd64; amd64; go1.24.4 (
golang-go); go1.26.4 (official tarball).
go on PATH. Mixing /usr/bin/go from apt with /usr/local/go/bin from the tarball causes confusing go version output unless you order PATH deliberately.
Choose an install method
| Method | Best for | On test host (trixie) |
|---|---|---|
apt install golang-go |
Servers, CI, Debian security updates | go1.24.4 (2:1.24~2) |
| Official tarball | Latest stable or pinned upstream version | go1.26.4 in /usr/local/go |
gccgo-go |
GCC-backed Go (unusual for app dev) | Available; conflicts with golang-go |
Snap go |
Optional; classic confinement | See install Go on Ubuntu snap section |
Check packages.debian.org/golang for library golang-*-dev packages—those are dependencies for other apps, not the main go toolchain.
What each Debian release ships
| Debian release | Typical golang-go line |
Notes |
|---|---|---|
| 13 (Trixie) | Go 1.24 | Tested below |
| 12 (Bookworm) | Go 1.22 (approx.) | Run apt-cache policy golang-go |
| 11 (Bullseye) | Go 1.19 (approx.) | Older modules may need a tarball |
Always confirm before installing:
. /etc/os-release && echo "$PRETTY_NAME"
apt-cache policy golang-go | head -8On Trixie before install:
Debian GNU/Linux 13 (trixie)
golang-go:
Candidate: 2:1.24~2
2:1.24~2 500
500 http://deb.debian.org/debian trixie/main amd64 PackagesPrerequisites
- Debian 11, 12, or 13 on amd64 or arm64 (match the tarball architecture).
- sudo for
aptinstalls. - For tarball installs: curl or wget,
tar, andsha256sum. - For CGO builds:
gccandlibc6-dev(CGO_ENABLED=1by default on the test host).
go version 2>/dev/null || echo "go: not installed"
which go 2>/dev/null || trueInstall Go with apt (recommended default)
The Reddit / forum FAQ answer on Debian is golang-go, not a bare golang or go package name:
sudo apt update
sudo apt install -y golang-go
go version
go env GOROOT GOPATH GOVERSION
which gogo version go1.24.4 linux/amd64
/usr/lib/go-1.24
/root/go
go1.24.4
/usr/bin/goPackages pulled on Trixie:
ii golang-1.24-go 1.24.4-1 amd64
ii golang-1.24-src 1.24.4-1 all
ii golang-go 2:1.24~2 amd64
ii golang-src 2:1.24~2 allOptional documentation:
sudo apt install -y golang-docInstall Go from the official tarball
When go version from apt is too old, use Installing Go (download page).
Download the latest stable release
GO_VERSION=$(curl -sL 'https://go.dev/VERSION?m=text' | head -1)
echo "$GO_VERSION"
curl -sL "https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz" -o "/tmp/${GO_VERSION}.linux-amd64.tar.gz"
ls -lh "/tmp/${GO_VERSION}.linux-amd64.tar.gz"go1.26.4
-rw-r--r-- 1 root root 64M Jun 29 09:33 /tmp/go1.26.4.linux-amd64.tar.gzOn arm64, replace linux-amd64 with linux-arm64.
Verify checksum (recommended)
Download the .sha256 file from the same Go downloads page and check:
curl -sL "https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz.sha256" -o /tmp/go.sha256
sha256sum --check /tmp/go.sha256Extract to /usr/local/go
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "/tmp/${GO_VERSION}.linux-amd64.tar.gz"
/usr/local/go/bin/go versiongo version go1.26.4 linux/amd64Add to PATH only when you want this build to override Debian’s go:
echo 'export PATH=/usr/local/go/bin:$PATH' >> ~/.profile
source ~/.profile
go version
which gogo version go1.26.4 linux/amd64
/usr/local/go/bin/goLeave PATH unchanged if you keep golang-go as the default and use /usr/local/go/bin/go only for specific projects.
Verify with Hello World and modules
Single-file run (works without go.mod):
mkdir -p ~/gotest
cat > ~/gotest/hello.go <<'EOF'
package main
import "fmt"
func main() {
fmt.Println("Hello from Debian golang-go")
}
EOF
cd ~/gotest
go run hello.go
go build -o hello hello.go
./helloHello from Debian golang-go
Hello from Debian golang-goNote: go build -o hello . fails without go.mod in module mode:
go: go.mod file not found in current directory or any parent directoryInitialize a module for a small project:
cd ~/gotest
go mod init example.com/hello
go run .go: creating new go.mod: module example.com/hello
Hello from Debian golang-goGOROOT, GOPATH, and environment
| Variable | golang-go (trixie) |
Official tarball |
|---|---|---|
| GOROOT | /usr/lib/go-1.24 |
/usr/local/go |
| GOPATH | ~/go (default) |
~/go (default) |
| Binary | /usr/bin/go |
/usr/local/go/bin/go |
Inspect settings:
go env GOROOT GOPATH GOVERSION CGO_ENABLED/usr/lib/go-1.24
/root/go
go1.24.4
1Persist custom GOPATH:
echo 'export GOPATH=$HOME/go' >> ~/.profile
echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.profilegccgo alternative
Debian ships gccgo-go—Go front end on GCC—at the same meta version as golang-go:
apt-cache policy gccgo-go | head -6gccgo-go:
Candidate: 2:1.24~2golang-go Conflicts with gccgo-go—install only one. Most tutorials and modules expect the gc toolchain from golang-go or go.dev.
Update Go
Debian package:
sudo apt update
sudo apt install --only-upgrade golang-go
go versionOfficial tarball: download a newer ${GO_VERSION}.linux-amd64.tar.gz, remove /usr/local/go, extract again, and re-check sha256sum.
List installed Go packages with list installed packages on Debian:
dpkg -l 'golang-*' 2>/dev/null | grep ^ii | head -10Uninstall Go
apt install
sudo apt remove --purge golang-go
sudo apt autoremove
go version 2>&1 || echo "go removed"Dry-run on the test host:
REMOVING:
golang-go
Remv golang-go [2:1.24~2]Orphaned golang-1.24-go packages may remain until autoremove—see uninstall golang for a full cleanup checklist.
Official tarball
sudo rm -rf /usr/local/go
# remove /usr/local/go/bin from ~/.profile or ~/.bashrcTroubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
go: command not found |
golang-go not installed |
sudo apt install golang-go |
Wrong go version after tarball |
Two installs on PATH |
which -a go; reorder PATH or remove one install |
go build . needs go.mod |
Module mode default | go mod init module/path or go build file.go |
go too old for go 1.25 in go.mod |
Debian lags upstream | Install tarball from go.dev/dl |
| CGO build errors | Missing gcc | sudo apt install build-essential |
Installed golang-github-*-dev by mistake |
Library dev package, not compiler | Install golang-go specifically |
References
- go.dev — Install Go
- go.dev — Download
- packages.debian.org — golang
- LinuxCapable — Install Go on Debian
- On-site: install Go on Ubuntu, uninstall golang, install sudo on Debian, apt command, curl, list installed packages
Summary
Install Go on Debian with sudo apt install golang-go when the suite version matches your project (go1.24.4 on Trixie here). For newer upstream releases, download the linux-amd64.tar.gz from go.dev, extract to /usr/local/go, and add /usr/local/go/bin to PATH only if it should replace /usr/bin/go. Verify with go version, go mod init, and a go run test—and avoid mixing two toolchains without a clear PATH order.

