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.
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
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.
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
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
Add the following content to the opened file:
export GOPATH=$HOME/go export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
Save and exit nano.
We need to update the environment variables in the system so that our changes can take effect. Enter the following command:
source ~/.profile
Now, we can verify whether the installation of golang is successful by entering the following command:
go version
If the terminal outputs the following content, then congratulations, you have successfully installed golang:
go version go1.16.5 linux/arm
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!