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 with Go π
Top comments (0)