Go installation error bash: go: command not found...

Go installation error bash: go: command not found...

Checking whether Go lang installed or not,

[test-user@localhost ~]$ eval $(go env)

Getting below error like go command not found,

bash: go: command not found...
Install package 'golang-bin' to provide command 'go'? [N/y] y

Proceed with changes? [N/y] y

Failed to install packages: Failed to obtain authentication.
-bash: syntax error near unexpected token `('

How to fix this error?

Looks like go lang is not installed in this system, need to install it.

Lets download the go lang package based on os type,

[test-user@localhost ~]$ wget https://go.dev/dl/go1.20.2.linux-amd64.tar.gz

For linux os, downloading this golang package,

--2023-03-14 19:24:03--  https://go.dev/dl/go1.20.2.linux-amd64.tar.gz
Resolving go.dev (go.dev)... 2001:4860:4802:38::15, 2001:4860:4802:36::15, 2001:4860:4802:32::15, ...
Connecting to go.dev (go.dev)|2001:4860:4802:38::15|:443... failed: Network is unreachable.
Connecting to go.dev (go.dev)|2001:4860:4802:36::15|:443... failed: Network is unreachable.
Connecting to go.dev (go.dev)|2001:4860:4802:32::15|:443... failed: Network is unreachable.
Connecting to go.dev (go.dev)|2001:4860:4802:34::15|:443... failed: Network is unreachable.
Connecting to go.dev (go.dev)|216.239.36.21|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://dl.google.com/go/go1.20.2.linux-amd64.tar.gz [following]
--2023-03-14 19:24:04--  https://dl.google.com/go/go1.20.2.linux-amd64.tar.gz
Resolving dl.google.com (dl.google.com)... 2a10:1450:4014:80a::200e, 182.251.36.89
Connecting to dl.google.com (dl.google.com)|2a00:1450:4014:81a::210e|:443... failed: Network is unreachable.
Connecting to dl.google.com (dl.google.com)|182.251.36.87|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 100107955 (95M) [application/x-gzip]
Saving to: ‘go1.20.2.linux-amd64.tar.gz’

go1.20.2.linux-amd64.tar.gz             	100%[========================================================================================>]  95.47M   103MB/s	in 0.9s    

2023-03-14 19:24:05 (103 MB/s) - ‘go1.20.2.linux-amd64.tar.gz’ saved 

Check whether downloaded golang compressed file properly or not,

[test-user@localhost ~]$ ls

Displayed,

go1.20.2.linux-amd64.tar.gz 

Lets configure this downloaded golang directory,

Need to remove existing golang directory if any,

[test-user@localhost ~]$ rm -rf /usr/local/go

decompress and copy golang dir to ‘/usr/local’ directory.

[test-user@localhost ~]$ sudo tar -C /usr/local/ -xzf go1.20.2.linux-amd64.tar.gz

set path variable for golang direcotry,

[test-user@localhost ~]$ export PATH=$PATH:/usr/local/go/bin

Now check go command using golang version,

[test-user@localhost ~]$ go version

displayed version,

go version go1.20.2 linux/amd64

run your command now,

[test-user@localhost ~]$ eval $(go env)

No error raised this time after golang setup.

[test-user@localhost ~]$ echo $GOPATH

Go lang directory path,

/home/test-user/go



Python installation

Privacy Policy  |  Copyrightcopyright symbol2020 - All Rights Reserved.  |  Contact us   |  Report website issues in Github   |  Facebook page   |  Google+ page

Email Facebook Google LinkedIn Twitter
^