기존 설치 버전 삭제
root@razor1911-Virtual-Machine:/home/razor1911/AdGuardHome# sudo apt remove --autoremove golang
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
gccgo-9 golang golang-1.13 golang-1.13-doc golang-1.13-go golang-1.13-race-detector-runtime golang-1.13-src golang-doc
golang-go golang-race-detector-runtime golang-src libgo-9-dev libgo14
0 upgraded, 0 newly installed, 13 to remove and 7 not upgraded.
After this operation, 520 MB disk space will be freed.
Do you want to continue? [Y/n]
다음 URL 에서 최신 go 설치본 URL 확인
다운로드
root@razor1911-Virtual-Machine:/home/razor1911# wget https://golang.org/dl/go1.17.2.linux-amd64.tar.gz
--2021-11-04 10:20:02-- https://golang.org/dl/go1.17.2.linux-amd64.tar.gz
Resolving golang.org (golang.org)... 34.64.4.49, 2404:f340:10:1801::2011
Connecting to golang.org (golang.org)|34.64.4.49|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://dl.google.com/go/go1.17.2.linux-amd64.tar.gz [following]
--2021-11-04 10:20:03-- https://dl.google.com/go/go1.17.2.linux-amd64.tar.gz
Resolving dl.google.com (dl.google.com)... 216.58.220.110, 2404:6800:4004:808::200e
Connecting to dl.google.com (dl.google.com)|216.58.220.110|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 134803982 (129M) [application/x-gzip]
Saving to: ‘go1.17.2.linux-amd64.tar.gz’
go1.17.2.linux-amd64.tar.gz 100%[===================================================>] 128.56M 46.5MB/s in 2.8s
2021-11-04 10:20:06 (46.5 MB/s) - ‘go1.17.2.linux-amd64.tar.gz’ saved [134803982/134803982]
root@razor1911-Virtual-Machine:/home/razor1911#
압축 해제 및 디렉토리 이동
root@razor1911-Virtual-Machine:/home/razor1911# sudo tar -xvf go1.17.2.linux-amd64.tar.gz
root@razor1911-Virtual-Machine:/home/razor1911# sudo mv go /usr/local
패스 설정
root@razor1911-Virtual-Machine:/home/razor1911# sudo mv go /usr/local
root@razor1911-Virtual-Machine:/home/razor1911# export GOROOT=/usr/local/go
root@razor1911-Virtual-Machine:/home/razor1911# export GOPATH=$HOME/Projects/Proj1
root@razor1911-Virtual-Machine:/home/razor1911# export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
root@razor1911-Virtual-Machine:/home/razor1911# go version
go version go1.17.2 linux/amd64
빌드
go build
'CS > Linux' 카테고리의 다른 글
리눅스에서 파일 EOL 확인하기 (0) | 2023.08.17 |
---|---|
Linux - screenfetch (0) | 2023.06.13 |
[CentOS] <username> is not in the sudoers file. This incident will reported. (0) | 2023.01.08 |
Ubuntu 패키지 특정 버전으로 설치하기 (0) | 2022.06.09 |