Home > Article > Backend Development > How to install golang
Golang is a common programming language with efficient compilation speed and good concurrency performance. If you want to use Golang, installing the programming language is a must. In this article, we will introduce how to install Golang.
Before installing Golang, we need to download the Golang installation file first. You can download the installation package for the corresponding platform from Golang’s official website [https://golang.org/dl/](https://golang.org/dl/);
In the download interface, you You can select the platform and operating system you need, and then click the Download
button to start downloading.
After downloading the installation file, you can start installing Golang. During the installation process, you need to pay attention to the following steps:
go.exe
, and then click Run
button. Then in the pop-up dialog box, click the Yes
button to accept the license agreement. C:\Go
), or you can choose a custom path. Then click the Install
button to start the installation. sudo tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
where$VERSION
is your Download the Golang version number, $OS
is the operating system you are using, $ARCH
is the processor architecture you are using.
PATH
environment variable and add Golang to the system path. You can use the following command: export PATH=$PATH:/usr/local/go/bin
Or you can add the above command to the .bashrc
file.
go version
If you see the version number of Golang, then congratulations, Golang is installed successfully!
After Golang is installed, we also need to set Golang’s environment variables. This will ensure that Golang runs smoothly.
This PC/My Computer
and select Properties
. Advanced system settings
and click Environment Variables
. System Variables
area, find the Path
variable. Then click the Edit
button. New
button, and then enter the Golang installation path C:\Go\bin
. OK
button to save the variables and close the dialog box. Command Prompt
or Windows PowerShell
, enter the following command to test whether Golang is normal: go version
.bashrc
file: nano ~/.bashrc
.bashrc
file Code: export PATH=$PATH:/usr/local/go/bin
Ctrl X
to exit editing, then enter Y
to save the file. source ~/.bashrc
go version
To Here, we have learned how to install Golang and set environment variables. If you encounter problems, you can find help in community discussions, such as [GolangCN Forum](https://gocn.vip/).
The above is the detailed content of How to install golang. For more information, please follow other related articles on the PHP Chinese website!