Logo

Developer learning path

Go

Installation on Linux in Go

Installation on Linux

64

#description

Installation of Go on Linux is a fairly simple process.

Follow the steps below to install Go on Linux:

  1. Download the latest version of Go for Linux from the official website.

You can download it using the following command:

                    
   wget https://golang.org/dl/go1.XX.X.linux-amd64.tar.gz
                  

Replace XX.X with the latest version number.

  1. Extract the downloaded file using the following command:
                    
   tar -C /usr/local -xzf go1.XX.X.linux-amd64.tar.gz
                  

This will extract the Go files to the /usr/local/go directory.

  1. Add Go to the system path by adding the following lines to the /etc/profile file:
                    
   export PATH=$PATH:/usr/local/go/bin
   export GOPATH=$HOME/go
                  

The first line adds the Go executable to the system path, while the second line sets the GOPATH environment variable to your Go workspace.

  1. Save the changes to the /etc/profile file and run the following command to apply the changes:
                    
   source /etc/profile
                  
  1. Verify that Go is installed correctly by running the command go version. You should see the version number of Go that you just installed.

That's it - you have successfully installed Go on Linux! You can now start writing and running Go programs on your system.

March 27, 2023

If you don't quite understand a paragraph in the lecture, just click on it and you can ask questions about it.

If you don't understand the whole question, click on the buttons below to get a new version of the explanation, practical examples, or to critique the question itself.