Setup and Install Go Development Environment on Ubuntu/Debian

Exported on 30-Aug-2021 14:09:42

Parameters

Name Type Script Reference Default Value Comment
s1 Linux / Unix Server s1
s1c Linux OS Credential s1c

1 - Download Go Package

Downloads binary release for go version 16.6

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Downloads v16.6 of go
curl -O https://storage.googleapis.com/golang/go1.16.6.linux-amd64.tar.gz

2 - Unpack go package

Unpacks the release package

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Unpack tar file
tar -xzf go1.16.6.linux-amd64.tar.gz

3 - Configure go path

Configures system path to include go executable

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Move to /usr/local dir
sudo mv go /usr/local

# Add go to path
echo 'export GOPATH=$HOME/work' >> ~/.profile 
echo 'export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin' >> ~/.profile

source ~/.profile

4 - Verify Installation

Verifies installation by printing installed go version.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# View go version
go version