Skip to content

Instantly share code, notes, and snippets.

@racheats
Created January 12, 2019 08:22
Show Gist options
  • Save racheats/1832e24f363d85c5f4b3afebba054c66 to your computer and use it in GitHub Desktop.
Save racheats/1832e24f363d85c5f4b3afebba054c66 to your computer and use it in GitHub Desktop.
Install golang on ubuntu 16.04
#!/bin/bash
# run => bash <script>
if [[ $EUID -ne 0 ]]; then
echo "Please run as root"
exit 100
fi
# updating package & upgrade security
apt-get update -y
apt-get upgrade -y
# get go installation
wget https://dl.google.com/go/go1.11.4.linux-amd64.tar.gz
# processing go installation
tar -xvf go1.11.4.linux-amd64.tar.gz
mv go /usr/local
# setting GOROOT
export GOROOT=/usr/local/go
# setting GOPATH
mkdir ~/go && export GOPATH=$HOME/go
# make go accesible globally
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
# verify go installation with checking version and env variable
go version
go env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment