How to install go language in yum

王林
Release: 2023-02-17 14:35:07
Original
5401 people have browsed it

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
Copy after login

2. Environment configuration

1) Open the profile file

vi /etc/profile
Copy after login

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
Copy after login

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

source /etc/profile
Copy after login

Check again:

$ go env
Copy after login
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"
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template