Home  >  Article  >  Backend Development  >  How to install go language in yum

How to install go language in yum

王林
王林Original
2021-01-08 11:13:385396browse

Yum installation go language method: 1. Execute the "yum -y install golang" command to install go; 2. Edit the profile file and configure environment variables; 3. Execute the "source /etc/profile" command. .

How to install go language in yum

#The operating environment of this article: centos 7 system, GO 1.11.2, thinkpad t480 computer.

Specific steps:

1. Install golang

yum -y install golang

2. Environment configuration

1) Open the profile file

vi /etc/profile

2) Add environment variables and append the following text after the file:

# GOROOT
export GOROOT=/usr/lib/golang
# GOPATH
export GOPATH=/root/go/
# GOPATH bin
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

It needs to take effect immediately. Execute the following command in the terminal:

source /etc/profile

Check again:

$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/golang"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build417743789=/tmp/go-build -gno-record-gcc-switches"

At this point, the Go language has been installed alright.

Related recommendations: golang tutorial

The above is the detailed content of How to install go language in yum. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Is go a dynamic language?Next article:Is go a dynamic language?