Home >Backend Development >Golang >How to set up centos go language environment
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.
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
and extract it to /usr/local
tar -C /usr/local -xzf go1.11.2.linux-amd64.tar.gz
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
Configure environment variables
vi /etc/profile
Add the following content at the end:
export GOROOT=/usr/local/go export GOPATH=/home/gopath export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
After saving, execute the following command to make the environment variables take effect immediately:
source /etc/profile
After installation, check whether the installation is successful
go env
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!