Home  >  Article  >  Backend Development  >  Detailed explanation of ubuntu golang installation method

Detailed explanation of ubuntu golang installation method

PHPz
PHPzOriginal
2023-03-29 09:24:171698browse

Under the Ubuntu system, the installation of Golang is very simple. This article will provide Golang installation methods under Ubuntu 18.04 system to make your development process more comfortable.

  1. Download the installation package

Go to the official website https://golang.org/dl/ and download the version that suits you. This article takes the go1.14.4.linux-amd64.tar.gz version as an example.

  1. Installation

Get to the point and move the downloaded go1.14.4.linux-amd64.tar.gz installation package to the specified directory (for example, move to / usr/local directory), and decompress:

$ sudo mv go1.14.4.linux-amd64.tar.gz /usr/local
$ cd /usr/local
$ sudo tar -xzvf go1.14.4.linux-amd64.tar.gz

Here, we decompress go to the /usr/local directory, which is also the officially recommended installation location.

  1. Configuring environment variables

In order for the system to find the Go running environment, the Go installation path needs to be added to the PATH path. This can be achieved by adding the following general configuration to the .bashrc file:

$ echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
  1. Environment variables take effect

In order to make the modification of environment variables take effect, you can execute the following command:

$ source ~/.bashrc

This command will make the changes to the environment variables take effect so that the newly installed Go can be used.

  1. Check the installation result

We can check the installation status by verifying whether the version number of Go or the modified system variable $PATH is effective:

$ go version

If something similar to the following appears:

go version go1.14.4 linux/amd64

, it means that Golang has been installed.

  1. Uninstall

If you no longer want to use Go, you can delete /usr/local/go (ie, the installation directory) directly.

Summary:

Through the above steps, we can install Golang into the Ubuntu system, and the Golang dependencies during the development process can also be satisfied. At the same time, Golang also has relatively excellent performance in terms of performance, which is worthy of developers to try. I hope the above content can help everyone.

The above is the detailed content of Detailed explanation of ubuntu golang installation method. 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