편집을 취소할 수 있습니다. 이 편집을 되돌리려면 아래의 바뀐 내용을 확인한 후 게시해주세요.
최신판 | 당신의 편집 | ||
1번째 줄: | 1번째 줄: | ||
{{다른뜻|우분투 go 1.6 설치}} | |||
{{테스트|Ubuntu 16, CentOS 7}} | {{테스트|Ubuntu 16, CentOS 7}} | ||
== | ==다운로드== | ||
* https://golang.org/dl/ 접속하여 최신버전 확인 | * https://golang.org/dl/ 접속하여 최신버전 확인 | ||
==설치== | ==설치== | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
GOLANG_VERSION=1.16.3 | |||
curl -LO https:// | |||
curl -LO https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz | |||
tar -C /usr/local -xvzf go${GOLANG_VERSION}.linux-amd64.tar.gz | |||
export PATH=$PATH:/usr/local/go/bin | export PATH=$PATH:/usr/local/go/bin | ||
go | |||
echo 'export GOPATH=$HOME/go' >> ~/.bash_profile | |||
sed '$!N; /^\(export GOPATH=.*\)\n\1$/!P; D' -i ~/.bash_profile | |||
source ~/.bash_profile | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== | ==테스트== | ||
<syntaxhighlight lang='console'> | <syntaxhighlight lang='console'> | ||
user01@localhost:~$ go version | |||
go version go1.16.3 linux/amd64 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
<syntaxhighlight lang=' | <syntaxhighlight lang='bash'> | ||
mkdir -p ~/go/src | |||
cd ~/go/src/ | |||
echo 'package main;import "fmt";func main(){ fmt.Println("hello world")}' > hello.go | |||
go run hello.go | |||
go build hello.go | |||
./hello | |||
</syntaxhighlight> | </syntaxhighlight> | ||
<syntaxhighlight lang='console'> | <syntaxhighlight lang='console'> | ||
user01@localhost:~$ mkdir -p ~/go/src | |||
go | user01@localhost:~$ cd ~/go/src/ | ||
user01@localhost:~/go/src$ echo 'package main;import "fmt";func main(){ fmt.Println("hello world")}' > hello.go | |||
user01@localhost:~/go/src$ go run hello.go | |||
hello world | |||
user01@localhost:~/go/src$ go build hello.go | |||
user01@localhost:~/go/src$ ./hello | |||
hello world | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==같이 보기== | ==같이 보기== | ||
* [[ | * [[우분투 go 1.6 설치]] | ||
==참고== | ==참고== |