Install Golang On Ubuntu
dev.toยท13hยท
Discuss: DEV
๐Ÿนgolang
Preview
Report Post

This guide walks through a clean, system-wide installation of Go using the official binary, following industry best practices.

๐Ÿ“‚ Step 1: Download the Latest Go Binary

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

๐Ÿ“‚ Step 2: Install Go System-Wide

tar -C /usr/local -xzf go1.25.6.linux-amd64.tar.gz

๐Ÿ“‚ Step 3: Configure Environment Variables (Global Setup)

cat <<EOF >/etc/profile.d/go.sh
export GOROOT=/usr/local/go
export GOPATH=/opt/go
export PATH=\$PATH:\$GOROOT/bin:\$GOPATH/bin
EOF

chmod +x /etc/profile.d/go.sh

๐Ÿ“‚ Step 4: Create GOPATH Directory Structure

mkdir -p /opt/go/{bin,src,pkg}

๐Ÿ“‚ Step 5: Reload Environment Variables

source /etc/profile

๐Ÿ“‚ Step 6: Verify the Installation

go version

*Happy coding โ€ฆ

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help