How to Install Go on Ubuntu and Debian Linux

Install Go on Ubuntu or Debian by downloading the binary, extracting it to /usr/local, and updating your PATH environment variable.

Install Go on Ubuntu or Debian by downloading the official binary, extracting it to /usr/local, and adding the binary directory to your PATH.

wget https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc

Verify the installation by running go version.