Installing the Latest Version of Golang on Your Raspberry Pi

Published on


Golang, or Go, is a modern and efficient programming language used for a variety of applications, including web development, system programming, and network programming. With its simple syntax and high-performance runtime, it's no wonder that it has become a popular choice for developers.

If you have a Raspberry Pi and want to start developing in Go, you'll need to install the latest version of the Golang runtime. In this article, we'll guide you through the installation process, step by step.


The first step is to update your Raspberry Pi's package index and install the dependencies required for the Golang runtime:

sudo apt update
sudo apt install -y wget git build-essential

Next, download the latest version of Golang:


Replace [version] with the latest version number of Golang. You can find that on their downloads page.

Then, extract the archive:

tar -xvf go[version].linux-armv6l.tar.gz

Move the extracted folder to /usr/local:

sudo mv go /usr/local

Set up the environment variables for Golang:

echo 'export GOROOT=/usr/local/go' >> ~/.zshrc
echo 'export GOPATH=$HOME/go' >> ~/.zshrc
echo 'export PATH=$GOPATH/bin:$GOROOT/bin:$PATH' >> ~/.zshrc
source ~/.zshrc

If you are using bash or something else, use the rc file for the same (for example .bashrc). The above instructions are for zsh.

One Script for Everything

To summarise, we can put all of this into a single shell script to download and setup golang on armhf architecture.



# Download the latest version of Golang

# Extract the archive
tar -C /usr/local -xzf go$VERSION.linux-armv6l.tar.gz

# Set the environment variable for Golang
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.zshrc
source ~/.zshrc

# Verify the installation
go version

# Clean up
rm go$VERSION.linux-armv6l.tar.gz


By following these simple steps, you should now have the latest version of Golang installed on your Raspberry Pi. Whether you're a seasoned Go developer or just starting out, the Raspberry Pi is a great platform for developing in Golang.

With its low cost, small form factor, and powerful hardware, it provides a great way to learn and experiment with the Go programming language.

Updates straight in your inbox!

A periodic update about my life, recent blog posts, TIL (Today I learned) related stuff, things I am building and more!

Share with others

Liked it?


You may also like

  • cloudflarehomelab

    Unleash the Power of Self-Hosted Services with Cloudflare Tunnels

    Say goodbye to complicated port forwarding and hello to effortless access to your self-hosted services with Cloudflare Tunnels. Discover how to configure and use this game-changing technology.

    5 min read
  • cloudflarehomelab

    Dynamic DNS Made Easy with Cloudflare API

    Get rid of the hassle of manual IP updates for your domain with our step-by-step guide on how to create a DDNS using Cloudflare DNS API. Effortlessly keep your domain pointing to your dynamic IP address with just a few simple scripts.

    4 min read
  • nodejshomelab

    Get Up and Running with the Latest Version of Node.js on Raspberry Pi

    Do you want to run the latest version of Node.js on your Raspberry Pi? This guide will take you through the process of installing the latest version of Node.js on armhf architecture using binary packages.

    2 min read