Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install Golang 1.4.1 on Ubuntu 14.04 AWS EC2
#!/bin/sh
# OPTIONAL FLAGS:
#
# -geoip true
# this will install maxmind geoip and auto update crontab file
#
# -cloudwatch true
# this will install aws cloud watch metrics and send them to aws dashboard
#
# -imagemagick true
# this will install imagemagick and magickwand
#
# process command line args
while echo $1 | grep -q ^-; do
eval $( echo $1 | sed 's/^-//' )=$2
shift
shift
done
# Install Golang 1.4 and Arc65 + dependencies on fresh Amazon AWS EC2 Ubuntu 14.04 LTS
echo "install correct language pack"
cat <<EOF > /etc/default/locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE=en_US.UTF-8
LC_ALL=en_US.UTF-8
EOF
. /etc/default/locale
echo "set correct timezone"
dpkg-reconfigure tzdata
echo "install basic requirements"
apt-get update && upgrade
apt-get install build-essential mercurial git libssl-dev pkg-config tree
echo "download Go and install it, as well as create GOPATH directory"
cd ~
wget https://storage.googleapis.com/golang/go1.4.1.linux-amd64.tar.gz
tar -xf go1.4.1.linux-amd64.tar.gz && rm go1.4.1.linux-amd64.tar.gz
mv go /usr/local && mkdir -p /usr/local/gopath
echo "set enviornment variables required for Go"
export GOROOT=/usr/local/go
export GOPATH=/usr/local/gopath
cat <<EOF >> ~/.bashrc
export GOROOT=/usr/local/go
export GOPATH=/usr/local/gopath
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
export GORACE=log_path=$GOPATH/racereport
export w=$GOPATH/src/github.com
EOF
. ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment