Skip to content

Instantly share code, notes, and snippets.

@blue-bird1
Forked from jacoelho/golang.sh
Last active October 9, 2018 03:56
Show Gist options
  • Save blue-bird1/9733b9778c7855ed5d47be0a919d5f70 to your computer and use it in GitHub Desktop.
Save blue-bird1/9733b9778c7855ed5d47be0a919d5f70 to your computer and use it in GitHub Desktop.
Install golang debian/ubuntu #debian
#!/bin/bash
export GOLANG_VERSION=1.10.2
export GOLANG_DOWNLOAD_URL=https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
export GOLANG_DOWNLOAD_SHA256=4b677d698c65370afa33757b6954ade60347aaca310ea92a63ed717d7cb0c2ff
apt-get update -qq
apt-get install -y --no-install-recommends \
g++ \
gcc \
libc6-dev \
make \
curl \
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