Install Specfic version of Go / Golang

To install Go (Golang) from a ZIP file on Ubuntu, you can

1. Download the Go ZIP file

First, download the Go binary from the official Go website. You can do this using wget in the terminal:

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

Make sure to replace go1.22.8.linux-amd64.tar.gz with the appropriate version of Go you want to install.

2. Extract the ZIP file

Once downloaded, extract the tarball to /usr/local:

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

3. Set up environment variables

Next, you need to configure your system’s environment variables so that the Go binary is accessible.

Open your shell profile (e.g., .bashrc or .zshrc) in a text editor:

nano ~/.bashrc

Add the following lines at the end of the file:

export PATH=$PATH:/usr/local/go/bin

Save and exit the editor (in nano, press CTRL+O, then CTRL+X).

4. Apply the changes

Apply the changes to your current shell session:

source ~/.bashrc

5. Verify the installation

To verify that Go was installed correctly, run:

go version

You should see the version of Go that you installed.