How to install golang on Raspbian system

PHPz
Release: 2023-04-14 11:50:53
Original
911 people have browsed it

Raspbian is a very popular Raspberry Pi operating system, which can be made more powerful by installing golang. Here we will give step-by-step instructions to help you install the latest version of golang in Raspbian operating system.

  1. Download golang

In the Raspbian operating system, you can download the latest version of golang from the official website through the following command:

wget https://dl.google.com/go/go1.16.5.linux-armv6l.tar.gz
Copy after login

Here we download The version is golang 1.16.5. If you need to download other versions, just change the version number in the download link.

  1. Decompress golang

After the download is completed, you need to decompress the downloaded file to the directory specified by the system. We can use the following command to decompress:

sudo tar -C /usr/local -xzf go1.16.5.linux-armv6l.tar.gz
Copy after login
  1. Set environment variables

After decompressing golang to the directory specified by the system, we also need to set some environment variables so that used in subsequent operations. We can set it up by opening a terminal and entering the following command:

nano ~/.profile
Copy after login

Add the following content to the opened file:

export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
Copy after login

Save and exit nano.

  1. Update system environment variables

We need to update the environment variables in the system so that our changes can take effect. Enter the following command:

source ~/.profile
Copy after login
  1. Verify whether the installation is successful

Now, we can verify whether the installation of golang is successful by entering the following command:

go version
Copy after login

If the terminal outputs the following content, then congratulations, you have successfully installed golang:

go version go1.16.5 linux/arm
Copy after login

Summary:

In this article, we describe how to install the latest version in the Raspbian operating system golang. With step-by-step guidance, you can complete this process with ease. Hope this article will be helpful to you.

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

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template