11/14/2016 - 2:44 PM

install golang on ubuntu

install golang on ubuntu

How to Install Go 1.6 on Ubuntu 16.04



This tutorial assumes that you have access to an Ubuntu 16.04 system, configured with a non-root user with sudo privileges as described in Initial Server Setup with Ubuntu 16.04.

Step 1 — Installing Go

    ssh sammy@your_server_ip
    cd ~
    curl -O https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz
    tar xvf go1.6.linux-amd64.tar.gz
    #You should now have a directory called go in your home directory. Recursively change go's owner and group to root, and move it to /usr/local:
    sudo chown -R root:root ./go
    sudo mv go /usr/local

Step 2 — Setting Go Paths

    sudo vim /etc/profile
    export GOPATH=/media/raven/Data/gowork
    export GOROOT=/usr/local/go
    export PATH=$PATH:$GOPATH/bin:$GOROOT/bin

    source /etc/profile

Step 3 — Testing Your Install

    mkdir $HOME/work
    nano ~/work/src/github.com/user/hello/hello.go