How to install golang on Centos


Step 1:
For win64

wget https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz

For win32

wget https://storage.googleapis.com/golang/go1.8.3.linux-386.tar.gz

Result example:

[root@tutorialspots ~]# wget https://storage.googleapis.com/golang/go1.8.3.linux-amd64.t
ar.gz
--2017-08-04 14:29:56--  https://storage.googleapis.com/golang/go1.8.3.linux-amd
64.tar.gz
Resolving storage.googleapis.com (storage.googleapis.com)... 2a00:1450:400d:809:
:2010, 172.217.18.80
Connecting to storage.googleapis.com (storage.googleapis.com)|2a00:1450:400d:809
::2010|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 90029041 (86M) [application/x-gzip]
Saving to: `go1.8.3.linux-amd64.tar.gz'

100%[======================================>] 90,029,041   247KB/s   in 52m 33s

2017-08-04 15:22:30 (27.9 KB/s) - `go1.8.3.linux-amd64.tar.gz' saved [90029041/9
0029041]

Step 2: extract tar.gz file
For win64

tar -xzf go1.8.3.linux-amd64.tar.gz -C /usr/local 

For win32

tar -xzf go1.8.3.linux-386.tar.gz -C /usr/local 

Step 3: Put the export declaration in ~/.bashrc.

export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
export GOPATH=/home/go
export GOBIN=$GOPATH/bin

(use your GOPATH)

Now you can use go command:

install go centos

[root@tutorialspots ~]# go
Go is a tool for managing Go source code.

Usage:

        go command [arguments]

The commands are:

        build       compile packages and dependencies
        clean       remove object files
        doc         show documentation for package or symbol
        env         print Go environment information
        bug         start a bug report
        fix         run go tool fix on packages
        fmt         run gofmt on package sources
        generate    generate Go files by processing source
        get         download and install packages and dependencies
        install     compile and install packages and dependencies
        list        list packages
        run         compile and run Go program
        test        test packages
        tool        run specified go tool
        version     print Go version
        vet         run go tool vet on packages

Use "go help [command]" for more information about a command.

Additional help topics:

        c           calling between Go and C
        buildmode   description of build modes
        filetype    file types
        gopath      GOPATH environment variable
        environment environment variables
        importpath  import path syntax
        packages    description of package lists
        testflag    description of testing flags
        testfunc    description of testing functions

Use "go help [topic]" for more information about that topic.

Related Post

No comments yet.

Leave a Reply