How to install Go in Ubuntu?

DevOps

YOUR COSMETIC CARE STARTS HERE

Find the Best Cosmetic Hospitals

Trusted • Curated • Easy

Looking for the right place for a cosmetic procedure? Explore top cosmetic hospitals in one place and choose with confidence.

“Small steps lead to big changes — today is a perfect day to begin.”

Explore Cosmetic Hospitals Compare hospitals, services & options quickly.

✓ Shortlist providers • ✓ Review options • ✓ Take the next step with confidence

1. Install Go on Ubuntu

First check your CPU architecture:

uname -m

If output is:

x86_64

install the AMD64 version:

sudo apt update
sudo apt install -y wget git curl build-essential

wget https://go.dev/dl/go1.26.5.linux-amd64.tar.gz

sudo rm -rf /usr/local/go

sudo tar -C /usr/local -xzf go1.26.5.linux-amd64.tar.gzCode language: JavaScript (javascript)

For an ARM64 Ubuntu machine (aarch64), use:

wget https://go.dev/dl/go1.26.5.linux-arm64.tar.gz

sudo rm -rf /usr/local/go

sudo tar -C /usr/local -xzf go1.26.5.linux-arm64.tar.gzCode language: JavaScript (javascript)

The official Go installation also recommends installing Go under /usr/local/go. (Go)

Official Go Linux installation guide

2. Configure PATH

Run:

echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
echo 'export PATH=$PATH:$HOME/go/bin' >> ~/.bashrc

source ~/.bashrcCode language: PHP (php)

Check:

go version

You should get something similar to:

go version go1.26.5 linux/amd64

Also check:

go env GOPATH

Usually:

/home/ubuntu/go

$HOME/go/bin is important because command-line tools installed using go install normally go there. (Go)

0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x