Ubuntu下安裝golang
golang編譯器安裝與配置
golang目前有兩種編譯,一個是golang官方提供的,另一個是gnu提供的gccgo;
golang官方編譯器安裝與配置
安裝gcc工具,因為golang有些功能是使用c寫的,所以構建golang的編譯是必須的
$ sudo apt-get install bison gawk gcc libc6-dev make
安裝mercurial工具,目的使用hg命令來提取golang的原始碼
$ sudo apt-get install mercurial
代取提取,如果您的網速比較慢的話,此步要多花點時間
$ hg clone -u release https://go.googlecode.com/hg/ go
編譯golang
$ cd go/src
$ ./all.bash
設定$PATH
$ cd /etc/profile.d/
$ vi go.sh
export GOROOT=/home/go
export GOPATH=/home/website
export GOBIN=$GOROOT/bin
export GOARCH=amd64
export GOOS=linux
export PATH=.:$PATH:$GOBIN
$ . ./go.sh
======================
參考
[url=http://wiki.ubuntu.org.cn/Golang#golang.E7.BC.96.E8.AF.91.E5.99.A8.E5.AE.89.E8.A3.85.E4.B8.8E.E9.85.8D.E7.BD.AE]ubuntu golang編譯器安裝與配置[/url]
[url=http://my.oschina.net/cmffire/blog/88804]golang install on centos[/url]