3
sudo apt-get update
sudo apt-get -y upgrade
wget https://dl.google.com/go/go1.12.6.linux-amd64.tar.gz

using this command I download Go to my device after that I try to extract the downloaded archive and install it to the desired location on the system. using below command

sudo tar -xvf go1.13.3.linux-amd64.tar.gz 
sudo mv go /usr/local

but I got error

sudo tar -xvf go1.12.6.linux-amd64.tar.gz
tar: go1.12.6.linux-amd64.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

what should I do?

Terrance
  • 41,612
  • 7
  • 124
  • 183

1 Answers1

1

Here is the answer to your question

Download the tarball for go

wget https://dl.google.com/go/go1.12.6.linux-amd64.tar.gz

Extract the tarball

tar -xzf go1.12.6.linux-amd64.tar.gz

Move the Folder to /usr/local/

sudo mv go /usr/local/

Add /usr/local/go/bin to the PATH

export PATH=$PATH:/usr/local/go/bin
Tejas Lotlikar
  • 2,945
  • 5
  • 17
  • 26
  • 1
    What's the point of installing third-party software from the internet when the golang package in Ubuntu Software is exactly the same version as the file from https://dl.google.com that you mentioned? Google doesn't 100% maintain their own go software for the Ubuntu platform. As a result I and people like me have to do some of it instead: https://stackoverflow.com/a/47420118. – karel Dec 01 '19 at 06:43
  • 1
    First of all, let me clarify that method does NOT install third party software. The package is downloaded directly from the google server (Go was designed at Google). Also, installing go using apt install golang (same with Ubuntu software center) might be a bad idea because the Ubuntu repo contains an older version. Also, OP has already downloaded the tarball, so i would like to know what is the point of wasting data by downloading again? – Tejas Lotlikar Dec 01 '19 at 06:57
  • By third party I meant not from the principal Ubuntu software sources which in this case are 1. The Ubuntu iso file which was used to install Ubuntu. 2. Ubuntu Software and the default Ubuntu repositories. By "third-party" I mean any software that comes from "somewhere else". Maybe I shouldn't use the phrase third-party anymore since it makes people think that software that is downloaded from the internet is vetted equivalently in Ubuntu to software from Ubuntu Software. – karel Dec 01 '19 at 06:59
  • "sudo mv go /usr/local/" when I try this command, $ sudo mv go /usr/local/ mv: cannot move 'go' to '/usr/local/go': Directory not empty – Dinushi Dhananjani Dec 04 '19 at 08:53
  • I have just installed go using the same procedure in a virtual machine. I have recorded the process in this video https://imgur.com/a/ccjSsBV (286 KB, 38s) – Tejas Lotlikar Dec 04 '19 at 11:45
  • Thank you dr, for your help :-)3 – Dinushi Dhananjani Dec 04 '19 at 16:25