Skip to content

Instantly share code, notes, and snippets.

@bumaociyuan
Forked from einthusan/go1.4arc65-ubuntu.sh
Last active September 23, 2015 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bumaociyuan/b72ee3638d8ec40e05a6 to your computer and use it in GitHub Desktop.
Save bumaociyuan/b72ee3638d8ec40e05a6 to your computer and use it in GitHub Desktop.
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