Catalogue
Standard Way to Install Golang

Standard Way to Install Golang

🌐 日本語で読む

Overview

This is exactly what is described on the official Golang site.

I’m writing this both as a reference for explanations in other Golang-related articles and as a memo for myself.

Environment

  • CentOS Linux release 7.3.1611 (Core)

Steps

I recommend installing the latest version that matches your environment from Golang Official - Downloads.

  • Build from source
1
2
3
$ cd /usr/local/src
$ sudo wget https://storage.googleapis.com/golang/go1.7.5.linux-amd64.tar.gz
$ sudo tar -C /usr/local -xzf go1.7.5.linux-amd64.tar.gz
  • Configure PATH
1
2
3
4
5
6
7
8
$ sudo cat << 'EOF' | sudo tee /etc/profile.d/golang.sh
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin
EOF

$ sudo cp /etc/profile.d/golang.sh /etc/profile.d/golang.csh

$ source /etc/profile
  • Verify
1
2
3
$ go version

go version go1.7.5 linux/amd64

That completes the Golang installation.

Author

Kenzo Tanaka

Posted on

2017-02-03

Licensed under