Home > Article > Backend Development > golang liunx installation
Go (also known as Golang) is an open source programming language developed by Google. It combines the efficiency of statically typed compiled languages with the ease of use of interpreted languages. The core concept of Go language is to take into account both efficiency and openness.
Linux is a free and open source operating system. It is one of the most famous server operating systems in the world and has a wide range of applications. In this article, we will introduce how to install the Go language environment on the Linux operating system.
Installation method:
Use a browser to enter the Go official website: https://golang.org/dl/, Select the appropriate version to download. In the following installation process, we will use the go1.14.2.linux-amd64.tar.gz version for demonstration.
Use the terminal to enter the download directory and decompress the downloaded Go language installation package:
tar -zxvf go1.14.2.linux-amd64.tar.gz
This will be in the current directory Create a folder named go, which contains all the files needed to run the Go language.
Set the GOROOT environment variable to indicate the installation path of the Go language:
sudo nano /etc/profile
Add the following content at the end of the file:
export GOROOT=/usr/local/go export PATH=$PATH:$GOROOT/bin
Save and exit.
Use the following command to make the environment variables take effect immediately:
source /etc/profile
Enter the following command:
go version
If the Go language version information is output, the installation is successful.
GOPATH is the Go language workspace path, used to specify the location of the working directory. You can set GOPATH to any folder path, for example:
mkdir $HOME/go export GOPATH=$HOME/go
Save and exit. Finally, synchronize the modifications:
source ~/.bashrc
At this point, we have successfully installed the Go language environment, configured the environment variables and GOPATH, and can happily develop Go language.
Conclusion:
Through the above simple steps, we have successfully installed the Go language environment on the Linux system and completed the configuration of environment variables and GOPATH. At this point, we can start our own development journey. If you have not started learning the Go language, I recommend you to attend some relevant training courses. Mastering the Go language will bring great help to your career development.
The above is the detailed content of golang liunx installation. For more information, please follow other related articles on the PHP Chinese website!