How to set up centos go language environment

青灯夜游
Release: 2023-01-11 09:23:28
Original
2930 people have browsed it

Method: 1. Download the installation package from the official website; 2. Extract the installation package to the "/usr/local" directory; 3. Establish a working directory; 4. Configure the environment in the "etc/profile" file variables, and then save the file; 5. Execute the "source /etc/profile" command to make the environment variables take effect immediately.

How to set up centos go language environment

The operating environment of this tutorial: centos 7.5 system, GO version 1.8.3, Dell G3 computer.

Recommended tutorial: "golang"

Centos7 Installation Go Language Environment

Download the installation package

Switch to any directory, this article is done under /root

Official website (https://golang.org/dl/ ) Find the installation package address. CentOS uses the Linux installation package. Download

wget https://dl.google.com/go/go1.11.2.linux-amd64.tar.gz
Copy after login

and extract it to /usr/local

tar -C /usr/local -xzf go1.11.2.linux-amd64.tar.gz
Copy after login

Create a working directory

Under the /home directory, create a directory named gopath, and create three more directories pkg, bin, and src under gopath

mkdir -p /home/go/src /home/go/pkg /home/go/bin
Copy after login

Configure environment variables

vi /etc/profile
Copy after login

Add the following content at the end:

export GOROOT=/usr/local/go
export GOPATH=/home/gopath
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
Copy after login

After saving, execute the following command to make the environment variables take effect immediately:

source /etc/profile
Copy after login

After installation, check whether the installation is successful

go env
Copy after login

For more programming-related knowledge, please visit: Programming Video! !

The above is the detailed content of How to set up centos go language environment. 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