Install Golang on WSL
Go is a modern programming language developed at Google at around 2007 to improve programming productivity. It is increasingly popular for its many applications like Docker, Kubernetes and popular static site generator like Hugo.
In this tutorial, we will install Go on our Windows Linux Subsystem environment.
First, we will install it using Ubuntu’s package manager, and then we will install it using the binary distribution.
Check version
Before we do anything lets check what version of Linux we have installed.
|
Our current version is 18.04, and the LTS means Long Term Support
From the beginning, Ubuntu has its packages, and we can install go within the apt-get
utility
Easy way
Open the terminal and lets update & upgrade our APT package utility and install go
|
Check
Let us check if it installed correctly
|
Install Binary Distribution
Let’s say we wanted to get the latest version, we would have to install the official binary distribution.
We first go to https://golang.org/dl/ and select a compatible release according to our OS
go1.11.5.linux-amd64.tar.gz
Let us open our terminal download our file and extract it in our current directory.
|
tar
: stores/extracts files from the archivex
: extracts the file from targetv
: verbosly list files processf
: use archive file
Now we have a folder /go
on our current directory. Let us move it to /usr/local/
|
Set Enviroments
Our last step is to add our global variables on our .bahsrc
or .profile
file.
|
scroll down and add these to your .bashrc
profile
|
To save it Ctrl + o
, and to exit nano Ctrl + x
update current session
|
Check
|