Installing Go on Ubuntu
| Reading Time : 2 minutes | #backenddevelopment #Go
This blog will walk through installing Go 1.14.1 on Ubuntu 18.04.4 LTS
sudo apt-get update
sudo apt-get -y upgrade
Next logical step is to download the Go binary file, Latest software will be available at https://golang.org/dl/ and to install the version of ubuntu run below commands in terminal
mkdir tmp
cd /tmp
wget https://dl.google.com/go/go1.14.1.linux-amd64.tar.gz
Extract the downloaded tar and installing into the desired location in system. But generally following the documentation its best to install it under /user/local/go
. Run below commands in terminal for installation
sudo tar -xvf go1.11.linux-amd64.tar.gz
sudo mv go /usr/local
Three Go language environment variables we are setting are GOROOT
, GOPATH
and PATH
.
GOROOT
is the path where Go installed in the machine
GOPATH
the location of the working directory.
In .profile
file add above said global variables at the end of the file. You may want to add this into a .zshrc
or.bashrc
file as per your shell configuration.
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
source ~/.profile
Go should have been now installed successfully on the machine and to check if it is run below command
go version
and if its installed and configured well you should see below output on the terminal
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/xxx/.cache/go-build"
GOENV="/home/xxx/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/rockey/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/xxx/snap/exercism/current/exercism/go/two-fer/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build151852922=/tmp/go-build -gno-record-gcc-switches"
Resources for further reading :
If you find anything wrong or outdated i’d really appreciate if you could drop me a note on my social media or email( rockey5520@gmail.com) would be amazing.
powerctl is a little weekend project I put together to provide a simple tool for managing power states on Linux. I had previously put my laptop into suspend with a basic “echo mem | doas tee /sys/power/state”, but this leaves a lot to be desired. I have to u…
via Drew DeVault's blog August 28, 2022Links to exhibits from the Microsoft anti-trust case, with a bit of info on each link. Projection of PC marketshare Share of new browser users Share of the browser market, grouped by major ISP, 3 month moving average Share of the browser market, grouped by ma…
via danluu.com August 24, 2022Hi all! This month I’ve been pondering offline-first apps. The online aspect of modern apps is an important feature for many use-cases: it enables collaboration between multiple people and seamless transition between devices (e.g. I often switch between my pe…
via emersion August 14, 2022Generated by openring