Last active
March 5, 2016 19:32
-
-
Save jeremyje/fb6c276b1863de7bd586 to your computer and use it in GitHub Desktop.
Script to Install Go and Go for App Engine on Linux and Cloud 9 IDE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Script to install Go, Go for App Engine, and Cloud SDK in Linux. | |
| # This script is designed for Cloud 9 IDE but works on regular Linux installs as well. | |
| # All packages are installed in the ${HOME}/development directory. | |
| # If you want to change that simply update the INSTALL_DIR variable. | |
| # | |
| # Usage: | |
| # chmod +x install-go.sh; ./install-go.sh ${PWD} | |
| GO_PROJECT=$1 | |
| if [ -z "$GO_PROJECT" ] | |
| then | |
| echo "Project directory was not specified." | |
| exit 1 | |
| fi | |
| echo $GO_PROJECT | |
| INSTALL_ROOT=${HOME}/development | |
| mkdir -p ${INSTALL_ROOT} | |
| # Install Go | |
| GO_INSTALL=${INSTALL_ROOT}/go | |
| GO_PACKAGE=go1.6.linux-amd64.tar.gz | |
| wget https://storage.googleapis.com/golang/${GO_PACKAGE} | |
| rm -rf ${GO_INSTALL} | |
| mkdir -p ${GO_INSTALL} | |
| tar -C ${INSTALL_ROOT} -xzf ${GO_PACKAGE} | |
| rm ${GO_PACKAGE} | |
| # Install Go for App Engine | |
| GO_GAE_INSTALL=${INSTALL_ROOT}/go_appengine | |
| GO_GAE_PACKAGE=go_appengine_sdk_linux_amd64-1.9.33.zip | |
| wget https://storage.googleapis.com/appengine-sdks/featured/${GO_GAE_PACKAGE} | |
| rm -rf ${GO_GAE_INSTALL} | |
| mkdir -p ${GO_GAE_INSTALL} | |
| unzip ${GO_GAE_PACKAGE} -d ${INSTALL_ROOT} | |
| rm ${GO_GAE_PACKAGE} | |
| # Install Cloud SDK | |
| CLOUD_SDK_INSTALL=${INSTALL_ROOT}/google-cloud-sdk | |
| CLOUD_SDK_PACKAGE=google-cloud-sdk.zip | |
| wget https://dl.google.com/dl/cloudsdk/channels/rapid/${CLOUD_SDK_PACKAGE} | |
| rm -rf ${CLOUD_SDK_INSTALL} | |
| mkdir -p ${CLOUD_SDK_INSTALL} | |
| unzip ${CLOUD_SDK_PACKAGE} -d ${INSTALL_ROOT} | |
| rm ${CLOUD_SDK_PACKAGE} | |
| pushd . | |
| cd ${CLOUD_SDK_INSTALL} | |
| source ./install.sh --usage-reporting false --command-completion true \ | |
| --path-update true --override-components gsutil core gcloud | |
| popd | |
| # Setup Environment | |
| GO_PRIMARY_PATH=${INSTALL_ROOT}/go-imports | |
| echo "export GOROOT=${GO_INSTALL}" >> ~/.bashrc | |
| echo "export GOPATH=${GO_PRIMARY_PATH}:${GO_PROJECT}" >> ~/.bashrc | |
| echo "export PATH=${GO_INSTALL}/bin:${GO_GAE_INSTALL}:$PATH" >> ~/.bashrc | |
| echo "Close all shell instances and restart them." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Install Go | |
| GO_PACKAGE=go1.6.linux-amd64.tar.gz | |
| curl https://storage.googleapis.com/golang/${GO_PACKAGE} | sudo tar -C /usr/local -xz | |
| sudo sh -c "echo 'export PATH=/usr/local/go/bin:${PATH}' >> /etc/profile" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment