This article will show different methods to install Go on your Raspberry Pi system.
Install Go on Raspberry Pi
There are two different ways to install Go programming language on a Raspberry Pi system:
Method 1: Install Go from Raspberry Pi Repository
You can easily install Go on Raspberry Pi from its official repository using the following command:
However, with this method, you won’t be able to install the latest version of Go on your Raspberry Pi system. To confirm the Go version installed using this method, use the following command:
Remove Go from Raspberry Pi
You can remove Go from your Raspberry Pi system easily through the following terminal command:
Method 2: Install Go from tar.gz File
If you want to install the latest version of, Go language on your Raspberry Pi system, you can use the following steps:
Step 1: Download Latest Go tar.gz File
To download the latest version of Go on Raspberry Pi, head towards the website and download the latest tar.gz file according to your Raspberry Pi version.
Since I am using 32-Bit Raspberry Pi OS, the command will look like this:
For 64Bit Raspberry Pi OS, you can download Go tar.gz file through the following command:
Step 2: Extract the Go Package to Local Folder
To install the Go package to a local folder, you should apply the following command:
Step 3: Configure Path for Go
You must add the path where the Go files are placed and to do that you have to open the following profile:
Add the following two lines at the bottom of this file:
GOPATH=$HOME/go
Save the file using the “CTR+X” keys and then press “Y”.
Step 4: Update Changes
To update the changes, apply the following command:
After making the changes, you can confirm the Go version using the following command:
Remove Go from Raspberry Pi
To remove Go installed from this method, you should execute the following command to delete the Go directory located at “/usr.local” path:
This removes Go from your Raspberry Pi system.
Conclusion
Go is a robust programming language helpful in developing different scalable applications. You can install this language on your Raspberry Pi system from two methods. The first method is installing it from the Raspberry Pi repository through the “apt” installation command. Though the method is easy, it won’t install the latest Go version on your system. The second method, through a tar.gz file, successfully installs the latest Go version on your Raspberry Pi system.