Installing GoLang on Ubuntu

GoLang is new programming lanuage by Google. It us used by many popular open source software like docker, kubernetics.

You can download latest version of golang from

https://golang.org/dl/

To install version 1.8.3, run

cd /usr/local/src
wget https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz
tar xvf go1.8.3.linux-amd64.tar.gz
mv go /usr/local

Edit .bashrc file

vi ~/.bashrc

Add

export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH:$GOPATH/bin:$PATH

Activate the changes with

source ~/.bashrc

GoLang is now ready to use, lets check the version

root@backup:~# go version
go version go1.8.3 linux/amd64
root@backup:~# 

Installing Software written in GoLang

To test, we can install google drive command line tool written in golang with

go get -u github.com/odeke-em/drive/cmd/drive

This may take some time. The command will download and compile the software. Place the binary file, in this case “drive” in folder ~/go/bin. Once finished, you can run it with command

root@backup:~# drive version
drive version: 0.3.9.1
Commit Hash: 
Go Version: 
OS: 
BuildTime: 
root@backup:~# 

Posted in Linux