Go
的權威倉庫地址是https://go.googlesource.com/go,同時還有一個鏡像倉庫在https://github.com/golang/go。gcc
和glibc-devel
,不須要Go來編譯)。若是以前已經安裝過老版本的Go,清除$GOPATH,
$GOROOT
變量。html
安裝好Git。linux
Git
git config --global user.email "email-for-github"
git config --global user.name "user name"
ssh-keygen -t rsa -b 2048
~/.ssh/id_rsa.pub
中的Public Key到github SSH settings以添加新的SSH key安裝 gcc
和glibc-devel
git
sudo yum install gcc glibc-devel
從源代碼編譯安裝Go1.4github
cd ~/
git clone git@github.com:golang/go.git
cd go
git checkout -b 1.4.3 go1.4.3
cd src
./all.bash
複製 ~/go
到 $GOROOT_BOOTSTRAP
(默認值是~/go1.4
)golang
cp ~/go ~/go1.4 -rf
從源代碼編譯安裝Go1.6bootstrap
cd ~/go
git clean -dfx
git checkout -b 1.6 go1.6
cd src
./all.bash
設置 $GOPATH
以及添加Go二進制路徑到 $PATH
centos
sudo vi /etc/profile
bash
# Golang Env export PATH=$PATH:/home/xx/go/bin export GOPATH=/home/xx/go-projects
重啓和測試網絡
sudo reboot
go version
ssh
go version go1.6 linux/amd64