Download and install Go quickly with the steps described here.
For other content on installing, you might be interested in:
- Managing Go installations -- How to install multiple versions and uninstall.
- Installing Go from source -- How to check out the sources, build them on your own machine, and run them.
Go installation
Select the tab for your computer's operating system below, then follow its installation instructions.
-
Remove any previous Go installation by deleting the
/usr/local/gofolder (if it exists), then extract the archive you just downloaded into/usr/local, creating a fresh Go tree in/usr/local/go:$ rm -rf /usr/local/go && tar -C /usr/local -xzf go1.14.3.linux-amd64.tar.gz(You may need to run each command separately with the necessary permissions, as root or through
sudo.)Do not untar the archive into an existing
/usr/local/gotree. This is known to produce broken Go installations. -
Add
/usr/local/go/binto thePATHenvironment variable.You can do this by adding the following line to your
$HOME/.profileor/etc/profile(for a system-wide installation):export PATH=$PATH:/usr/local/go/binNote: Changes made to a profile file may not apply until the next time you log into your computer. To apply the changes immediately, just run the shell commands directly or execute them from the profile using a command such as
source $HOME/.profile. -
Add
$HOME/go/bin(the default Go bin path) to yourPATHenvironment variable to use tools installed viago install.You can do this by adding the following line to your
$HOME/.profileor$HOME/.bashrcfile:export PATH="$PATH:$(go env GOPATH)/bin" - Restart any open terminal sessions for the changes to take effect.
-
Verify that you've installed Go by opening a command prompt and typing
the following command:
$ go version - Confirm that the command prints the installed version of Go.