Install Golang In Centos 7

How to install Golang on Centos 7

1. Downlaod Go binary
   # wget https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz
2. Verify tarball
   # sha256sum go1.10.3.linux-amd64.tar.gz
3. Extract the tarball 
   # sudo tar -C /usr/local -xzf go1.10.3.linux-amd64.tar.gz
4. Adjust the Path Variable.
   # nano ~/.bash_profile
    export PATH=$PATH:/usr/local/go/bin
source ~/.bash_profile
5. Test Installation
a. # mkdir ~/go
b. # mkdir -p ~/go/src/hello
c. ~/go/src/hello/hello.go
package main
import "fmt"
func main() {
    fmt.Printf("Hello, World\n")
}
d. # cd ~/go/src/hello
e. # go build
f. # ./hello

Post a Comment

Previous Post Next Post