You can refer to this article about how to install Golang on Ubuntu AMI and Amazon AMI.
Also, in current release, we recommend to use Golang 1.12 and Ubuntu AMI on AWS.
sudo apt-get update
sudo apt-get -y upgrade
Download the Go language binary archive.
wget https://dl.google.com/go/go1.12.linux-amd64.tar.gz
sudo tar -xvf go1.12.linux-amd64.tar.gz
sudo mv go /usr/local
Setup Go environment, including GOROOT
and GOPATH
. Add enviornment variables to the ~/.profile
.
export GOROOT=/usr/local/go
mkdir $HOME/project
export GOPATH=$HOME/project
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
Verify installation
~$ go version
~$ go version go1.12 linux/amd64
~$ go env
...
GOOS="linux"
GOPATH="/home/ubuntu/project"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
...
If you could see above information, you are all set with Golang installation!