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.
Make sure you're in the pocket home directory.
cd ~
Find the latest version of Go from https://golang.org/dl/ then download it with the following command:
wget https://dl.google.com/go/go1.17.7.linux-amd64.tar.gz
Note: Change
go1.17.7.linux-amd64.tar.gz
to the most recent version of Go.Extract the archive
sudo tar -xvf go1.17.7.linux-amd64.tar.gz
Set permissions on the extracted files
sudo chown -R pocket ./go
Set the
PATH
variableecho 'export PATH=$PATH:$HOME/go/bin' >> ~/.profile
Set the
GOPATH
andGOBIN
variablesecho 'export GOPATH=$HOME/go' >> ~/.profile
echo 'export GOBIN=$HOME/go/bin' >> ~/.profile
Source the
.profile
source ~/.profile
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.
tipIf
go version
doesn't work try logging out and logging back in. Then test thego version
command again.
- Verify the
GOPATH
andGOBIN
variables are set correctlyYou should see thego env
GOPATH
andGOBIN
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.