MeshWorld India LogoMeshWorld.

How to Install Go (Golang) on Ubuntu & Linux (2026)

(Updated: Jul 24, 2026)
Listen to ArticleAI Speech
~5 min read narration
100%
How to Install Go (Golang) on Ubuntu & Linux (2026)

Go (often referred to as Golang) is an open-source programming language created at Google by Robert Griesemer, Rob Pike, and Ken Thompson. Designed for simplicity, concurrency, and high execution speed, Go powers modern cloud-native infrastructure including Docker, Kubernetes, Terraform, Hugo, Caddy, and Prometheus.

While Ubuntu’s default package repositories provide Go binaries via apt, installing official release archives from go.dev/dl ensures access to the latest release builds (Go 1.22+), performance optimizations, and security patches.

Whether configuring a new development environment on Ubuntu 24.04 LTS (Noble Numbat) or 22.04 LTS (Jammy Jellyfish), here is the step-by-step installation guide for 2026.

Last updated: July 24, 2026


What are the system requirements for installing Go on Linux?

Before installing Go on Ubuntu, Debian, or Linux Mint, ensure your environment meets these baseline dependencies:

  • Operating System: Ubuntu 24.04 LTS, 22.04 LTS, Debian 12, or Linux Mint 22
  • Utilities: curl or wget, tar, sudo administrative access, and a terminal
  • Architecture: 64-bit x86_64 (amd64) or ARM64 (arm64) CPU architecture

How do you install Go from official release binaries?

Downloading and extracting the official Go release tarball provides a clean, portable installation isolated under /usr/local/go.

Step 1: Download the Latest Go Release Tarball

Open your terminal (Ctrl+Alt+T) and fetch the latest stable Go release using curl or wget:

BASH
# Fetch latest version tag automatically from Go official API
GO_VERSION=$(curl -s https://go.dev/dl/?mode=json | grep -o 'go[0-9.]*' | head -n 1)

# Download 64-bit Linux AMD64 release archive
wget https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz

Step 2: Remove Old Installations and Extract Archive

Remove any pre-existing /usr/local/go directory and extract the fresh archive into /usr/local:

BASH
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf ${GO_VERSION}.linux-amd64.tar.gz

Step 3: Configure Shell Environment Variables (PATH & GOPATH)

Add Go binaries (/usr/local/go/bin) and your workspace binary path ($HOME/go/bin) to your shell environment file (~/.bashrc for Bash or ~/.zshrc for Zsh):

BASH
# Append Go PATH exports to ~/.bashrc
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
echo 'export GOPATH=$HOME/go' >> ~/.bashrc
echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc

Step 4: Reload Shell Profile and Verify

Apply the updated environment variables to your current session:

BASH
source ~/.bashrc

Confirm that Go is correctly installed and accessible:

BASH
go version

Expected output example: go version go1.2x.x linux/amd64

Check full Go environment configuration:

BASH
go env

How do you install Go using APT package manager?

If you prefer standard package management via apt, Go is available in Ubuntu default repositories:

BASH
sudo apt update
sudo apt install -y golang-go

Note: The APT repository version may lag several release versions behind upstream go.dev builds.


How do you create and run your first Go program?

Modern Go uses Go Modules (go.mod) for dependency management.

Step 1: Initialize a Project Directory

Create a project folder and initialize a module:

BASH
mkdir hello-go
cd hello-go
go mod init example.com/hello-go

This creates a go.mod file tracking your module path and Go version.

Step 2: Write Main Source File

Create main.go:

BASH
nano main.go

Paste the following code:

GO
package main

import "fmt"

func main() {
    fmt.Println("Hello from Go on Ubuntu!")
}

Save and close the file (Ctrl+O, Enter, Ctrl+X).

Step 3: Run and Build the Program

Run your Go program directly without creating a permanent binary:

BASH
go run main.go

Compile a standalone, optimized binary executable:

BASH
go build

Run your compiled binary:

BASH
./hello-go


Frequently Asked Questions (PAA)

What is the difference between GOPATH and GOROOT?

GOROOT specifies the directory path where the Go SDK and compiler tools are installed (typically /usr/local/go). GOPATH specifies your user workspace directory (typically $HOME/go) where downloaded third-party packages and compiled binaries are stored.

Where does go install place compiled executable tools?

Binaries installed via go install package@latest are saved to $GOPATH/bin (or $HOME/go/bin). Ensure $GOPATH/bin is in your shell PATH to run installed CLI tools globally.

How do I completely uninstall Go installed via tarball?

Delete the /usr/local/go directory and remove the PATH export lines from your ~/.bashrc or ~/.zshrc file:

BASH
sudo rm -rf /usr/local/go

Reader Quality Feedback

Did this technical guide help solve your problem?

Suggest Errata ($0)
Vishnu
Primary Author

Vishnu

Founder & Principal Architect at MeshWorld. Senior engineer and instructor specializing in AI agent systems, scalable web architecture, and modern development workflows.

Explore Author Archive
Vishnu
Editorial Reviewer

Vishnu

Founder & Principal Architect at MeshWorld. Senior engineer and instructor specializing in AI agent systems, scalable web architecture, and modern development workflows.

View Dossier
Compute Fuel & Open Testbed
100% Independent & Verified

Fuel High-Density, Zero-Fluff Engineering Deep-Dives

Every guide on MeshWorld is validated on physical Linux nodes and reproducible testbeds. If this article saved you hours of debugging or unblocked production, consider funding our next cluster run.

Weekly Dispatch

Join MeshWorld Dispatch

Get practical tutorials, system blueprints, and curated AI engineering notes straight to your inbox. No fluff, zero spam.

Zero spam. 1-click unsubscribe anytime.Prefer RSS?
Curated Continuations

Up Next in This Domain.

Browse Full Archive