centos7 安装go环境
依赖包gcc make glibc (yum -y install gcc make glibc )
wget https://storage.googleapis.com/golang/go1.4.linux-amd64.tar.gz (此地址需翻墙)
cd go
tar -xvf go1.4.linux-amd64.tar.gz
Install Go
To build the Go distribution, run
$ cd go/src
$ ./all.bash
(To build under Windows use all.bat.)
测试
ALL TESTS PASSED
---
Installed Go for linux/amd64 in /home/you/go.
Installed commands in /home/you/go/bin.
*** You need to add /home/you/go/bin to your $PATH. ***
where the details on the last few lines reflect the operating system, architecture, and root directory used during the install.
For more information about ways to control the build, see the discussion of environment variables below. all.bash (or all.bat) runs important tests for Go, which can take more time than simply building Go. If you do not want to run the test suite use make.bash (or make.bat) instead.
Testing your installation
Check that Go is installed correctly by building a simple program.
Create a file named hello.go and put the following program in it:
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
Then run it with the go tool:
$ go run hello.go
hello, world
If you see the "hello, world" message then Go is installed correctly.
问题解决
No package 'libpcre' found
yum install pcre-devel
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
评论