Go language is available in Raspberry Pi OS distribution and you can install it with apt install golang
, but at the time of writing this article, the latest version in distribution is 2:1.11~1+b6
or 1.11
.
Here I will show how to get latest stable version of golang for Raspberry Pi OS (armhf/arm32).
Requirements
- Rapsberry Pi 2/3/4
Get Go Language
Go to golang download page. Find latest or prefered version of golang. Make sure to download golang with file name like go[version].linux-armv6l.tar.gz (for RaspberryPi OS ARM32). For example go1.16.2.linux-armv6l.tar.gz, this version is for Linux OS Arch ARMv6 that works for RaspberryPi OS.
Install the Archive
- In my case, the downloaded archive located in Downloads folder, then run folowing command in directory Downloads
1
sudo tar -C /usr/local/lib -xzf go1.16.2.linux-armv6l.tar.gz
note : I install it in /usr/local/lib
- Here I add following line to
$HOME/.profile
file. (it’s easier & simple to put the line in user profile 😛)
export PATH=$PATH:/usr/local/go/bin
- Next run
. ~/.profile
or restart your Pi. Then check if Go language is installed withgo version
command.
End
Thats all I can share now, next you can use Go to start coding or install/build software.
Good luck and thanks for reading. Don’t forget to share this article to your friends 😄