1. Installation
yum install golang
2. Configure Environment variables
New Go directory as project directory
mkdir -p $HOME/go
Use the Cat method to add configuration Golang at the tail goroot gopath
cat >>$HOME/.bash_profile<<EOFexport GOROOT=/usr/lib/golangexport GOPATH=\$HOME/golangexport PATH=\$PATH:\$GOROOT/binEOF
Let the configuration take effect
source $HOME/.bash_profile
3. Check the ENV environment variable of Go
go env
Output
goarch= "AMD64" gobin= "goexe=" "gohostarch=" AMD64 "gohostos=" Linux "goos=" Linux "gopath="/root/golang " Gorace= "" goroot= "/usr/lib/golang" gotooldir= "/usr/lib/golang/pkg/tool/linux_amd64" GCCGO= "GCCGO" CC= "GCC" Gogccflags= "-fpic-m64-pthread-fmessage-length=0-fdebug-prefix-map=/tmp/go-build349580051=/tmp/go-build- Gno-record-gcc-switches "cxx=" g++ "cgo_enabled=" 1 "cgo_cflags="-g-o2 "cgo_cppflags=" "cgo_cxxflags="-g-o2 "CGO_ fflags= "-g-o2" cgo_ldflags= "-g-o2" pkg_config= "Pkg-config"