Skip to content

Instantly share code, notes, and snippets.

@neolaw84
Last active May 6, 2021 01:19
Show Gist options
  • Save neolaw84/ad61a5c6bfa6cdce8e0830df8bb5483f to your computer and use it in GitHub Desktop.
Save neolaw84/ad61a5c6bfa6cdce8e0830df8bb5483f to your computer and use it in GitHub Desktop.
Setting up the Google Compute Engine Virtual Machine

Setting up the Google Compute Engine Virtual Machine

Situation/Problem

Need to set-up a Google Compute Engine Virtual Machine for development jobs. We need:

  • set-up ssh keys
  • java and maven
  • anaconda
  • docker

Actions/Solutions

Set-up SSH Keys

Configure OS Login and IAM roles

  1. Enable the OS Login feature on your project or on individual instances.
  2. Grant the necessary IAM roles to yourself, your project members, or your organization members.
  3. Add SSH keys to the account (https://cloud.google.com/compute/docs/instances/managing-instance-access#add_oslogin_keys)

Refer to: https://cloud.google.com/compute/docs/instances/managing-instance-access

Upload your SSH private key to the instance

  1. SSH into the instance using web console
  2. Upload using the "gear" icon on top right.

Refer to: https://cloud.google.com/compute/docs/instances/transfer-files

Installing Java and Maven

  1. Update the apt-get
  2. Install build-essential, default-jdk and maven
sudo apt-get update
sudo apt-get install build-essential default-jdk maven
java -version
mvn -version

Installing Anaconda

  1. Download anaconda
  2. Change permission to 755
  3. Run the downloaded script
curl -L -O https://repo.anaconda.com/archive/Anaconda3-2019.07-Linux-x86_64.sh
chmod 755 Anaconda3-2019.07-Linux-x86_64.sh 
./Anaconda3-2019.07-Linux-x86_64.sh 

Installing Docker

  1. Install docker from apt repository
sudo apt-get install docker.io

Refer to https://forums.docker.com/t/how-do-i-change-the-docker-image-installation-directory/1169 to re-direct.

Results

Set-up the GCE VM for development containing:

  • SSH keys
  • Java
  • Maven
  • Anaconda
  • Docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment