Background
Let us avail the go runtime on our system.
Lineage
- OS
- Microsoft – MS Windows
Link
- Microsoft – MS Windows
Linux
Though my primary OS is MS Windows, I play around a bit with Linux, as well.
Options
There are a couple of options for availing go on a Linux system.
The options include:-
- rpm
- Repositories
- tar.gz
We will go with fetching the tar from golang.
Outline
- Artifact
- Identify Artifacts Source
- Determine appropriate artifact
- Get Artifact
- Install or Avail Artifact
- Configure System
Artifacts
Identify Artifact Source
The artifacts are available here.
Images
Image – Featured Downloads
Image – Stable Versions
Determine Appropriate Artifact
Matrix
Here are the choices for a Linux Machine:-
|
Choice
We are running 64-bit Linux on an Intel/AMD Architecture.
And, so we will go with go1.15.linux-amd64.tar.gz.
Get Artifact
There are a couple of choices to download a file from a web server ( HTTP).
Choices
- wget
wget
Syntax
wget
Sample
wget --no-check-certificate -O /tmp/go1.15.linux-amd64.tar.gz https://golang.org/dl/go1.15.linux-amd64.tar.gz
Output
Output – Image
Output – Text
>wget --no-check-certificate -O /tmp/go1.15.linux-amd64.tar.gz https://golang.org/dl/go1.15.linux-amd64.tar.gz --2020-08-30 11:23:53-- https://golang.org/dl/go1.15.linux-amd64.tar.gz Resolving golang.org (golang.org)... 172.217.6.81, 2607:f8b0:4005:809::2011 Connecting to golang.org (golang.org)|172.217.6.81|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://dl.google.com/go/go1.15.linux-amd64.tar.gz [following] --2020-08-30 11:23:54-- https://dl.google.com/go/go1.15.linux-amd64.tar.gz Resolving dl.google.com (dl.google.com)... 172.217.6.78, 2607:f8b0:4005:807::200e Connecting to dl.google.com (dl.google.com)|172.217.6.78|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 121136135 (116M) [application/octet-stream] Saving to: ‘/tmp/go1.15.linux-amd64.tar.gz’ /tmp/go1.15.linux-amd64.tar.gz 100%[=====================================================================================>] 115.52M 3.47MB/s in 33s 2020-08-30 11:24:27 (3.53 MB/s) - ‘/tmp/go1.15.linux-amd64.tar.gz’ saved [121136135/121136135] >
Install or Avail Artifact
There are a couple of choices to install or avail files on Linux.
Choices
- Installer
- rpm
- Extract Package
- Extraction Tools
- tar
- Extraction Tools
Installer
rpm
- It seems that golang does not have an rpm file for Linux Installation.
Extract Package
Extraction Tool
tar
Syntax
sudo tar
Sample
sudo tar -C /usr/local -v -xzf go1.15.linux-amd64.tar.gz
Output
Output – Image
Output – Text
>sudo tar -C /usr/local -v -xzf go1.15.linux-amd64.tar.gz | more go/ go/AUTHORS go/CONTRIBUTING.md go/CONTRIBUTORS go/LICENSE go/PATENTS go/README.md go/SECURITY.md go/VERSION go/api/ go/api/README go/api/except.txt go/api/go1.1.txt go/api/go1.10.txt go/api/go1.11.txt go/api/go1.12.txt go/api/go1.13.txt go/api/go1.14.txt go/api/go1.15.txt go/api/go1.2.txt go/api/go1.3.txt go/api/go1.4.txt go/api/go1.5.txt
Configure System
Outline
- Boundary
- Entire System ( /etc/profile )
- Self ( $HOME/.profile )
- Elements
- Path
- Changes
- OS – CentOS
Boundary
Decide on the boundary of what should be configured or affected.
If the entire system, please use ( /etc/profile ).
On the other hand, if you alone, ( $HOME/.profile ).
Elements
Here are the items that we will be configuring:-
- Path
Changes
System – /etc/profile
Outline
- Add a file to the /etc/profile.d folder
- The file should add /usr/local/go/bin to the system’s path
- export PATH=$PATH:/usr/local/go/bin
- Execute Added File
- source <file>
Add File to /etc/profile.d Folder
In our case, we will name the file ( /etc/profile.d/golangInstallSelf.sh ).
File Contents
>sudo cat /etc/profile.d/golangInstallSelf.sh [sudo] password for dadeniji: export PATH=$PATH:/usr/local/go/bin >
Execute Loaded File
source <file>
Image
Validate
To validate installation:-
System ( /etc/profile )
- Initiate go
Syntax
go version
Sample
go version
Output
Output – Image
Output – Text
>go version go version go1.15 linux/amd64 >