Skip to main content

2-2: Install Go

Go is the programming language that the Pocket software was written in. So, we'll need to install Go. We could install it using apt-get but we want to get the latest stable version which probably isn't available in the apt-get repository. So, we'll use the steps below to install Go.

  1. Make sure you're in the pocket home directory.

     cd ~
  2. Find the latest version of Go from then download it with the following command:


    Note: Change go1.17.7.linux-amd64.tar.gz to the most recent version of Go.

  3. Extract the archive

     sudo tar -xvf go1.17.7.linux-amd64.tar.gz
  4. Set permissions on the extracted files

     sudo chown -R pocket ./go
  5. Set the PATH variable

     echo 'export PATH=$PATH:$HOME/go/bin' >> ~/.profile
  6. Set the GOPATH and GOBIN variables

     echo 'export GOPATH=$HOME/go' >> ~/.profile
     echo 'export GOBIN=$HOME/go/bin' >> ~/.profile
  7. Source the .profile

     source ~/.profile
  8. Verify the installation

     go version

    You should see something like:

    go version go1.17.7 linux/amd64

    Note: Make sure the version matches the version you downloaded.


    If go version doesn't work try logging out and logging back in. Then test the go version command again.

  1. Verify the GOPATH and GOBIN variables are set correctly
     go env
    You should see the GOPATH and GOBIN variables set correctly.

Having issues?

If you have issues getting the latest version of Go working, it might be because there is an older version of Go installed with apt-get. To remove the old version of Go, do the following:

sudo apt-get purge golang*

Note: After doing this, you might need to reinstall Go. But first log out and log back in and test with go version.

After you can verify that you have the latest stable version of Go, you're ready to continue.