Skip to content

Instantly share code, notes, and snippets.

@lvnilesh
Forked from jacoelho/golang.sh
Last active November 2, 2017 04:59
Show Gist options
  • Save lvnilesh/dbcfebac2cc52d920d314dce5a38be37 to your computer and use it in GitHub Desktop.
Save lvnilesh/dbcfebac2cc52d920d314dce5a38be37 to your computer and use it in GitHub Desktop.
Install golang debian/ubuntu
#!/bin/bash
export GOLANG_VERSION=1.9.2
export GOLANG_DOWNLOAD_URL=https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
export GOLANG_DOWNLOAD_SHA256=de874549d9a8d8d8062be05808509c09a88a248e77ec14eb77453530829ac02b
apt-get update -qq
apt-get install -y --no-install-recommends \
g++ \
gcc \
libc6-dev \
make \
git-core
curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
&& tar -C /usr/local -xzf golang.tar.gz \
&& rm golang.tar.gz
for bin in $(ls /usr/local/go/bin/); do
test -f /usr/bin/$bin && rm /usr/bin/$bin
update-alternatives --install /usr/bin/$bin $bin /usr/local/go/bin/$bin 1
update-alternatives --set $bin /usr/local/go/bin/$bin
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment