Install Go On Ubuntu Linux
Install Go on Ubuntu Linux
Akbar S. Ahmed | Feb 25, 2015

Step-by-step instructions

In this post we will install Go on Ubuntu Linux. Installation is quick and simple.

Install Go

mkdir -p ~/opt/packages && cd $_

wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz

gzip -dc go1.4.2.linux-amd64.tar.gz | tar xf -

sudo mv go /usr/local

rm go1.4.2.linux-amd64.tar.gz

Add go to your PATH

vi ~/.profile

Paste the following into your .profile file.

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

Source your .profile file.

source ~/.profile

Package setup

Change akbarahmed to your GitHub login.

mkdir -p $GOPATH/src/github.com/akbarahmed && cd $_

mkdir hello && cd $_

vi hello.go

Paste the following into hello.go.

package main

import "fmt"

func main() {
    fmt.Printf("Hello from go.\n")
}

Compile the hello.go program then run it.

go install

hello
# Expected output: Hello from go.

Congrats, you are now ready to begin developing applications with Go.




Subscribe to our newsletter

Contact Information

ABOUT EXPONENTIAL.IO

We specialize in helping professional developers, like you, expand your skill set. Our courses are focused on enabling you to learn everything necessary to use a new technology in a live, production application.

LOCATION

All courses are made with love in
Palo Alto, CA.

Subscribe to our newsletter