• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How To Install Go 1.13 on Ubuntu 18.04 & 16.04 LTS

Written by Rahul, Updated on October 31, 2019
Programming Go, Golang, Ubuntu

Go is an open-source programming language developed by a team at Google. It provides easy to build simple, reliable, and efficient software. This language is designed for writing servers, that’s why it is using widely these days. Go has released the latest version 1.13. This tutorial will help you to install Go 1.12 on your Ubuntu 19.10, 18.04 LTS, 16.04 LTS, and 14.04 LTS systems.

Step 1 – Install Go on Ubuntu

Login to your Ubuntu system using ssh and upgrade to apply latest security updates there.

sudo apt-get update
sudo apt-get -y upgrade

Now download the Go language binary archive file using following link. To find and download latest version available or 32 bit version go to official download page.

wget https://dl.google.com/go/go1.13.3.linux-amd64.tar.gz

Now extract the downloaded archive and install it to the desired location on the system. For this tutorial, I am installing it under /usr/local directory. You can also put this under the home directory (for shared hosting) or other location.

sudo tar -xvf go1.13.3.linux-amd64.tar.gz
sudo mv go /usr/local

Step 2 – Setup Go Environment

Now you need to setup Go language environment variables for your project. Commonly you need to set 3 environment variables as GOROOT, GOPATH and PATH.

GOROOT is the location where Go package is installed on your system.

export GOROOT=/usr/local/go

GOPATH is the location of your work directory. For example my project directory is ~/Projects/Proj1 .

export GOPATH=$HOME/Projects/Proj1

Now set the PATH variable to access go binary system wide.

export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

All the above environment will be set for your current session only. To make it permanent add above commands in ~/.profile file.

Step 3 – Verify Installation

At this step, you have successfully installed and configured go language on your system. First, use the following command to check the Go version.

go version

go version go1.13.3 linux/amd64

Now also verify all configured environment variables using following command.

go env

GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/Projects/Proj1"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
...
...

Share it!
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

Related Posts

  • How To Install Go 1.13 on MacOS

    July 25, 2019
  • How to Install Webmin on Ubuntu 18.04 & 16.04 LTS

    May 15, 2019
  • How To Install Specific Package Version on Ubuntu & Debian

    January 1, 2019
  • Download Ubuntu 18.04 LTS – DVD ISO Images

    December 22, 2018
  • How to Install Package Updates on Ubuntu via Command-Line

    December 5, 2018

41 Comments

  1. Avatar Askat Reply to Askat
    November 5, 2019 at 4:46 am

    You forgot to say sudo ln -s /usr/local/go/bin/go /usr/bin/go

  2. Avatar Keisuke Yasuda Reply to Keisuke
    November 1, 2019 at 3:12 am

    It helps me a lot, Thanks!

  3. Avatar Everton Marques Reply to Everton
    September 17, 2019 at 7:04 pm

    update-golang is a script to easily fetch and install new Golang releases:

    git clone https://github.com/udhos/update-golang
    cd update-golang
    sudo ./update-golang.sh

  4. Avatar KopoNeo Reply to KopoNeo
    September 2, 2019 at 12:39 pm

    nice work, thanks a lot

  5. Avatar Aaro Reply to Aaro
    August 18, 2019 at 9:44 am

    That was helpful, thanks man.

  6. Avatar Coenraad Loubser Reply to Coenraad
    July 19, 2019 at 8:59 am

    Or just go to https://github.com/golang/go/wiki/Ubuntu

  7. Avatar Mike Reply to Mike
    July 6, 2019 at 2:14 am

    Best tech support site ever.

  8. Avatar Rico Reply to Rico
    June 29, 2019 at 7:36 am

    nice work!

  9. Avatar goodguy Reply to goodguy
    June 28, 2019 at 10:31 am

    I need such short tutorial, Thanks Rahul

« Previous 1 2 3 4

Leave a Reply

Cancel reply

Popular Posts

  • How to Install Python 3.8 on Ubuntu, Debian and LinuxMint
  • How to Restart Network Service on CentOS 8 or RHEL 8
  • How to Check IP Address on CentOS 8
  • How to Install Java 11/8 on Amazon Linux
  • How to Configure Static IP on CentOS 8 (CLI)
Copyright © 2013-2019 TecAdmin.net. All Rights Reserved. This site uses cookies. By using this website you agree with our term and services
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkNo
Revoke cookies