/ go

How to run Go 1.5 on CentOS 7.

In the previous post we installed Go on CentOS 7. There is an small problem by doing that, the latest version on the repos for Go is 1.4. In this post I will show how to install Go 1.5 using the binaries.

This is a manual procedure and there are other ways to achieve this.

Downloading binaries###

[[email protected] tmp]# wget https://storage.googleapis.com/golang/go1.5.linux-amd64.tar.gz

Extract the binaries to /usr/local/go:

[[email protected] tmp]# tar -C /usr/local -xzf /tmp/go1.5.linux-amd64.tar.gz

Now we will create the We create symbolic links (you can also add /usr/local/go/ to your PATH):

[[email protected] tmp]# ln -s /usr/local/go/bin/go /usr/bin/go
[[email protected] tmp]# ln -s /usr/local/go/bin/go /usr/local/bin/go
[[email protected] tmp]# ln -s /usr/local/go/bin/godoc /usr/local/bin/godoc
[[email protected] tmp]# ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt

Verify that Go v1.5 runs

Run go version to verify that the install worked and version is 1.5:

[[email protected] ~]# go version
go version go1.5 linux/amd64

Verify that code can run by creating a "hello world" program:

[[email protected] ~]# cat << EOF > hello.go
package main

import "fmt"
func main() {
fmt.Printf("hello world!\n")

Run it:

[[email protected] ~]# go run hello.go
hola, mundo

Now you have Go 1.5 running on your CentOS 7 OS.

Julio Villarreal Pelegrino

Julio Villarreal Pelegrino

Julio Villarreal Pelegrino is an Architect and Systems Engineer with over 15 years of experience in the Software Industry. Currently, he is a Chief Architect - Cloud and Infrastructure at Red Hat.

Read More