Download and install
we can install the Go Lang in very easy and simple steps in Linux(Ubuntu)
1. Download Go
2. Install Go
3. Check version of Go
1. Download Go.
Use Curl or wget to download the current binary for Go from the official download page.
sudo wget https://golang.org/dl/go1.15.5.linux-amd64.tar.gz
If Wget or curl not install, install wget and curl first.
2. Go install.
Extract the archive you downloaded into /usr/local, creating a Go tree in /usr/local/go by below command.
Important: This step will remove a previous installation at /usr/local/go, if any, prior to extracting. Please back up any data before proceeding.
For example, run the following.
sudo tar -C /usr/local -xzf go1.15.5.linux-amd64.tar.gz
Add the go binary path to .bashrc file /etc/profile. Add /usr/local/go/bin to the PATH environment variable.
You can do this by adding the following line to your $HOME/.profile or /etc/profile (for a system-wide installation):
export PATH=$PATH:/usr/local/go/bin
After adding the PATH environment variable, you need to apply changes immediately by running the following command.
source ~/.bashrc3. Check version of Go
Verify that you've installed Go by opening a command prompt and typing the following command:
go version
You can also install go from the snap store too.
sudo snap install --classic --channel=1.15/stable go
Remove Go Lang from the system completely:
To remove an existing Go installation from your system delete the go directory. This is usually /usr/local/go under Linux.
sudo rm -rf /usr/local/go
sudo nano ~/.bashrc # remove the entry from $PATH
source ~/.bashrc