Go is a statically typed, compiled programming language designed at Google by Robert Griesemer, Rob Pike, and Ken Thompson. It is syntactically similar to C, but with memory safety, garbage collection, structural typing, and CSP-style concurrency.
To install Go on Linux, follow these steps:
- Open a terminal window by pressing
Ctrl+Alt+T
on your keyboard. - Download the latest Go package by running the following command:
wget https://golang.org/dl/goX.Y.Z.linux-amd64.tar.gz
Replace X.Y.Z
with the latest version of Go, such as 1.16.3
.
- Extract the downloaded package by running the following command:
tar -xzf goX.Y.Z.linux-amd64.tar.gz
Replace X.Y.Z
with the version of Go that you downloaded in the previous step.
- Move the extracted directory to the
/usr/local
directory by running the following command:
sudo mv go /usr/local
- Add the Go binary directory to your
PATH
environment variable by running the following command:
export PATH=$PATH:/usr/local/go/bin
This will allow you to run Go commands from any directory.
- Verify that Go has been installed correctly by running the following command:
go version
This should print the version of Go that you installed, such as go version goX.Y.Z linux/amd64
.
That’s it! You have successfully installed Go on your Linux system. You can now use Go to develop and run your Go programs and scripts.