In this post we will see how to install Go in Ubuntu 20.04 LTS.Here we will be looking at step by step process to do this.
1.First go to the Go website and check out the Downloads button .Right click on Linux and copy the link location and then let’s move to terminal.
2.In the terminal type paste the copied link with wget . Command
: $wget https://go.dev/dl/go1.17.4.linux-amd64.tar.gz
3.Now unzip the downloaded file with the following command :
$tar -xzvf go1.17.4.linux-amd64.tar.gz .Now you will have one go folder and inside this you will have something like below :
4.Now move the go binary folder to a other location . Type the following command :
$sudo mv go /usr/local/ .Now if you list the files in user local you should see that go belongs in there.
5.Now try typing command :
$go . If you see something like the computer not recognizing the go command then what you need to do is you need to add the go binary to your paths. So you can do that by adding it to a file in your home directory called bashrc. We can open that using the command :
$vi ~/.bashrc The file look like this .
shift+g to go to bottom.Now add the line at bottom :
$ export PATH=$PATH:/usr/local/go/bin .Ctrl+c to get out of insert mode and then if type
: WQ to go out of the file now.
7.Now you could type
$which go and that shows the location.
In this way , following these steps you will be able to install Go and use it.