• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Install Go in CentOS 7

{{postValue.id}}

How to install Go in CentOS 7

Go is an open source programming language developed by Google. It provides easy to build, simple, reliable, and efficient software. This article helps you with the installation of Go language.

Install Go Language

The initial procedure is to download the Go language binary archive file by using following link.

To find and download latest version available or 32 bit version go to official download page.

[root@linuxhelp1 ~]# wget https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz
--2016-12-31 07:33:01--  https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz
Resolving storage.googleapis.com (storage.googleapis.com)... 216.58.196.112, 2404:6800:4007:802::2010
Connecting to storage.googleapis.com (storage.googleapis.com)|216.58.196.112|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 84021919 (80M) [application/x-gzip]
Saving to: ‘ go1.7.4.linux-amd64.tar.gz’ 

100%[===========================================================> ] 84,021,919   800KB/s   in 1m 40s 

2016-12-31 07:34:41 (822 KB/s) - ‘ go1.7.4.linux-amd64.tar.gz’  saved [84021919/84021919]

Now extract the downloaded archive and install it to desired location on system.

Here /usr/local directory is used, but you can also use home directory (for shared hosting) or other location.

[root@linuxhelp1 ~]# tar -xvf go1.7.4.linux-amd64.tar.gz 
go/
go/AUTHORS
go/CONTRIBUTING.md
go/CONTRIBUTORS
go/LICENSE
go/PATENTS
go/README.md
go/VERSION
go/api/
go/api/README
go/api/except.txt
go/api/go1.1.txt
go/api/go1.2.txt
.
.
.
go/test/varinit.go
go/test/writebarrier.go
go/test/zerodivide.go

Once it is downloaded, move the directory to local as follows.

[root@linuxhelp1 ~]# mv go /usr/local/

Setup Go Environment
It is required to set up the Go language environment variables for your project.

Generally, 3 environment variables such as GOROOT, GOPATH and PATH are needed. GOROOT is the location where Go package is installed on your system.

[root@linuxhelp1 ~]# export GOROOT=/usr/local/go

Now create the GOROOT directory path with the help of following command.

[root@linuxhelp1 ~]# mkdir -p /root/Projects/Proj1

GOPATH is the location of your work directory. For example, the directory used in this tutorial is ~/Projects/Proj1 .

[root@linuxhelp1 ~]# export GOROOT=$HOME/Projects/Proj1

Now set the PATH variable to access go binary system wide

[root@linuxhelp1 ~]# export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

All above environment will be set for your current session only. To make it permanent add above commands in ~/.bash_profile file

Verify Installation
You have installed and configured Go language on your system, but it is essential to verify the installation. You can use the the following command to check Go version .

[root@linuxhelp1 ~]# go version
go version go1.7.4 linux/amd64

You can also verify all configured environment variables using the following command.

[root@linuxhelp1 ~]# go env
GOARCH=" amd64" 
GOBIN=" " 
GOEXE=" " 
GOHOSTARCH=" amd64" 
GOHOSTOS=" linux" 
GOOS=" linux" 
GOPATH=" " 
GORACE=" " 
GOROOT=" /usr/local/go/bin" 
GOTOOLDIR=" /usr/local/go/bin/pkg/tool/linux_amd64" 
CC=" gcc" 
GOGCCFLAGS=" -fPIC -m64 -pthread -fmessage-length=0" 
CXX=" g++" 
CGO_ENABLED=" 1" 

Tags:
sebastian
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

Provide the link for downloading the GO application in centos?

A

use the following link to download the GO package
https://storage.googleapis.com/golang/ => link used for updating it

Q

Why GOROOT is used in centos?

A

Go is an open source programming language developed by Google. It provides easy to build, simple, reliable, and efficient software. This article helps you with the installation of Go language.

Q

how to export particular path in centos?

A

use the following syntax to export particular path in centos # export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

Q

How to check the version of GO in centos?

A

You can use the the following command to check Go version
# go version

Q

which command to verify all configured environment variables?

A

You can also verify all configured environment variables using the following command.
# go env

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Gibbson ?
How do i run both nginx and apache in same instance on centos

Hi...,

my server is based centos operating system and my webserver is already running on Apache.... i need to run both apache and nginx on same instance ... please help me to implement this concept...

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.