티스토리 뷰
맨날 gopath 설정 같은 걸 까먹어서 기록을 해둡니다.
참고 : https://go.dev/doc/install
Download and install - The Go Programming Language
Documentation Download and install Download and install Download and install Go quickly with the steps described here. For other content on installing, you might be interested in: Download Don't see your operating system here? Try one of the other download
go.dev
1. go 다운로드 받기
All releases - The Go Programming Language
go.dev
해당 페이지에서 원하는 버전을 다운로드 받거나 wget으로 가져옵니다.
$ wget https://golang.org/dl/go1.21.6.linux-amd64.tar.gz
2. 압축 풀기
이전 go 버전을 지우고 /usr/local 에 해당 파일을 압축 해제합니다.
$ rm -rf /usr/local/go && tar -C /usr/local -xvf go1.21.6.linux-amd64.tar.gz
3. path 등록
.profile 또는 .bash_profile 에 path 를 등록합니다. (os에 맞는 걸로, ~ 에서 있는 것에 등록)
go 설치 path 는 앞서 설치한 /usr/local/go 입니다.
원래 GOPATH도 따로 등록해주어야 했던 것 같지만 go env 로 확인해보니 이제 $HOME/go 로 자동 등록이 되는 것 같습니다.
그렇기 때문에 .profile에도 GOPATH도 추가해 PATH와 연결시키겠습니다.
$ vi .profile
GOROOT=/usr/local/go
GOPATH=$HOME/go
PATH=$PATH:$GOROOT/bin:$GOPATH/bin
# 위 내용 추가
그리고 reboot를 하거나 .profile 업데이트 내용을 적용해 줍니다.
$ source .profile
4. 확인
$ go version
잘 되는 지 체크
'메모' 카테고리의 다른 글
polars vs pandas 비교 테스트 (1) | 2025.01.26 |
---|---|
Modular Mojo / MAX (0) | 2024.09.29 |
git 간단 정리 (0) | 2024.01.11 |
PS Rust 입출력 (0) | 2023.01.09 |
Ubuntu Openssl 설치 (0) | 2022.11.20 |