Skip to content

Instantly share code, notes, and snippets.

@frunkad
Last active August 1, 2020 15:08
Show Gist options
  • Select an option

  • Save frunkad/059aa6e1f2ff9639bf8b6ffd1f661d3a to your computer and use it in GitHub Desktop.

Select an option

Save frunkad/059aa6e1f2ff9639bf8b6ffd1f661d3a to your computer and use it in GitHub Desktop.
Startup Script for Compute Engine Instances
set -v
PROJECTID=$(curl -s "http://metadata.google.internal/computeMetadata/v1/project/project-id" -H "Metadata-Flavor: Google")
# Install logging monitor. The monitor will automatically pick up logs sent to
# syslog.
curl -s "https://storage.googleapis.com/signals-agents/logging/google-fluentd-install.sh" | bash
service google-fluentd restart &
# Install dependencies from apt
apt-get update
apt-get install -yq ca-certificates git build-essential supervisor zsh
# Install nodejs via NVM
export NVM_DIR="/opt/nvm"
mkdir $NVM_DIR
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install node 12
which node
# Setup GitConfig
export HOME=/root
git config --global credential.'https://source.developers.google.com'.helper gcloud.sh
# Install go
curl -O https://golang.org/dl/go1.14.6.linux-amd64.tar.gz
tar -xvf go1.11.2.linux-amd64.tar.gz
sudo mv go /usr/local
# Install zsh
apt install zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
apt install fonts-powerline
# Run these on first use
# sudo chsh -s /bin/zsh "$USER"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment