Home  >  Article  >  Backend Development  >  golang download and install

golang download and install

王林
王林Original
2023-05-10 22:49:403979browse

Go is an open source and efficient programming language, suitable for application scenarios such as network development, writing server and CLI tools. How to download and install the Go language? Let’s learn more about it below.

1. Download

First, we need to download the Go installation package suitable for our operating system from the official website, the URL is: https://golang.org/dl/.

Choose the appropriate version to download. For Windows systems, you can choose the MSI installation package or zip compressed package. For macOS systems, you can download the .pkg installation package. For Linux systems, it is recommended to use a package manager such as apt or yum to install or use a binary package to install.

If you are using a Windows system, you can open the https://golang.org/dl/ page and select the latest stable version or switch to the "Early Versions" tab and select the historical version. Then download the corresponding installation package. For 64-bit systems, select the "Windows AMD64" version.

2. Installation

After downloading the Go installation package, we need to follow the following steps to complete the installation of Go.

  1. Windows system

If you downloaded the MSI installation package, just double-click to run it and follow the prompts to complete the installation. If you downloaded the zip package, unzip it to the directory you want.

  1. macOS system

Double-click the downloaded .pkg installation package to run it, and then follow the prompts. This will automatically create an entry for the installation in Mac OS X.

  1. Linux system

If you are using a Debian-based distribution such as Debian or Ubuntu, you can use the following command to install Go.

sudo apt-get update
sudo apt-get install golang

If you are using a distribution such as CentOS or Fedora, you can use the following command.

sudo yum install golang

or

sudo dnf install golang

  1. Set environment variables

Whether you Whatever system you use, you need to set the Go environment variables after the installation is complete. Specific steps are as follows.

Windows users can find the system Path in the system variables and add the Go installation path (generally the default is C:Go in).

MacOS or Linux users need to open the terminal and enter the following command.

export PATH=$PATH:/usr/local/go/bin

This will add the /usr/local/go/bin directory to the PATH environment variable so that it can be used in the terminal Run the go command directly.

  1. Verify installation

After completing the installation of Go, we can verify whether the installation is successful by running go version on the command line. If the current version number is returned, it means that Go has been installed successfully.

3. Summary

Through the above steps, we have successfully downloaded and installed the Go programming language. After the installation is complete, you can try to enter the Go command on the command line to verify whether Go can work properly. Hope this article is helpful to you!

The above is the detailed content of golang download and install. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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
Previous article:Does Alibaba use golang?Next article:Does Alibaba use golang?