Method of Installing golang under linux

  • 2021-07-03 01:02:03
  • OfStack

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. With concise, fast, safe, parallel, interesting, open source, memory management, v array security, compile quickly.

Go is designed as a system programming language for giant central servers equipped with Web servers, storage clusters, or similar applications. For the field of high-performance distributed systems, Go language undoubtedly has higher development efficiency than most other languages. It provides massive parallel support, which is perfect for the development of game server. This article introduces you to the method of installing golang under linux, as follows:

1. Download the golang source installation package


wget https://dl.google.com/go/go1.12.1.linux-amd64.tar.gz

2. Unzip the file


tar -zxvf go1.12.1.linux-amd64.tar.gz -C /usr/local/bin/

3. Configure environment variables


echo "export GOROOT=/usr/local/bin/go/" >> ~/.bashrc
echo "export PATH=$GOROOT/bin:$PATH" >> ~/.bashrc
echo "export GOPATH=$HOME/work/go" >> ~/.bashrc
echo "export PATH=$PATH:$GOPATH/bin" >> ~/.bashrc
source ~/.bashrc

Test whether the installation is successful


[root@iZ2ze40depfadmv9xdxdsxZ src]# go version
go version go1.12.1 linux/amd64

Summarize


Related articles: