리눅스 Go 설치

(우분투 go 최신버전 설치에서 넘어옴)

1 개요[ | ]

리눅스 Go 설치

2 설치[ | ]

GO_VERSION=1.22.0
curl -LO https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
grep /usr/local/go/bin $HOME/.profile || echo 'export PATH=$PATH:/usr/local/go/bin' >> $HOME/.profile
export PATH=$PATH:/usr/local/go/bin
go version

3 실습[ | ]

root@localhost:~# GO_VERSION=1.19.4
root@localhost:~# curl -LO https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  142M  100  142M    0     0  5290k      0  0:00:27  0:00:27 --:--:-- 5915k
root@localhost:~# rm -rf /usr/local/go && tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
root@localhost:~# cat ~/.profile | grep /usr/local/go/bin || echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile
root@localhost:~# cat ~/.profile | grep GOPATH= || echo 'export GOPATH=$(go env GOPATH)' >> ~/.profile
root@localhost:~# cat ~/.profile | grep GOPATH/bin || echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.profile
root@localhost:~# source ~/.profile
root@localhost:~# echo $GOPATH
/root/go
root@localhost:~# go version
go version go1.19.4 linux/amd64

4 같이 보기[ | ]

5 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}