DEV Community

Cover image for How to Install Go on the Raspberry Pi
Jeremy Morgan
Jeremy Morgan

Posted on • Updated on • Originally published at jeremymorgan.com

How to Install Go on the Raspberry Pi

f you want to install Go on your Raspberry Pi you have a few options. In the past there was a lot of cross compiling and hacking to get it done, but now you can install it through Apt. However, you're likely to find an older version.

How to install Go on Raspberry Pi

For instance at the time of this writing, an updated Raspberry Pi OS shows a version of 1.11.1 in the repositories. However the current version is 1.14.3 so if the latest version is important to you, here's your solution.

Step 1: Get the Latest Package

To get the latest version, browse on over to the Go download page and look for the latest version.

How to install Go on Raspberry Pi

Look for the "ARM v6 version" for the Raspberry Pi.

My current archive is https://dl.google.com/go/go1.14.4.linux-armv6l.tar.gz

Whichever archive you choose, use wget to download it:

mkdir ~/src && cd ~/src
wget https://dl.google.com/go/go1.14.4.linux-armv6l.tar.gz
Enter fullscreen mode Exit fullscreen mode

Now you have the latest package.

Step 2: Extract the Package

Now you'll want to extract the package into your local folder:

sudo tar -C /usr/local -xzf go1.14.4.linux-armv6l.tar.gz
rm go1.14.4.linux-arm64.tar.gz
Enter fullscreen mode Exit fullscreen mode

Step 3: Configure Go

Now you just need to configure it, which you have to do with any Go installation anyway.

Open up your ~/.profile (Using nano, vi, etc)

vi ~/.profile
Enter fullscreen mode Exit fullscreen mode

and add the following:

PATH=$PATH:/usr/local/go/bin
GOPATH=$HOME/go
Enter fullscreen mode Exit fullscreen mode

Notice here you can set your go path to whatever you like. I prefer /go, but you can put this wherever you want.

Update your shell with your changes:

source ~/.profile
Enter fullscreen mode Exit fullscreen mode

And check your version:

How to install Go on Raspberry Pi

And you're good to Go!

Get it? Yeah I'll show myself out.

Enjoy!

Top comments (0)