Skip to content

Instantly share code, notes, and snippets.

@jiristepan
Last active November 18, 2024 09:08
Show Gist options
  • Save jiristepan/d2c5c889dec7095e7390a76f5f9625d6 to your computer and use it in GitHub Desktop.
Save jiristepan/d2c5c889dec7095e7390a76f5f9625d6 to your computer and use it in GitHub Desktop.
Install nodejs, gcloud and docker on Debian9 in WSL mode
#!/bin/sh
#####################################################################
#
# tools form development and google cloud management instalation
# tested on debian9 for Windows10 https://www.microsoft.com/en-us/p/debian-gnu-linux/9msvkqc78pk6?activetab=pivot%3Aoverviewtab
#
# run as regular user, don't use sudo!
#
# will install:
# - tools like vim, git, curl
# - nodejs
# - google cloud console
# - firebase tools
# - bc, uuid,
# - python
# - R
#
# @author [email protected]
# @version 1.1.0
#
####################################################################
# COPY AND RUN THIS COMMANDS
# sudo apt-get update && sudo apt-get install wget -y
# wget "https://gist.githubusercontent.com/jiristepan/d2c5c889dec7095e7390a76f5f9625d6/raw/install-debian.sh"
# chmod +x ./install-debian.sh
# ./install-debian.sh
############################ configuration #################
# comment what you don't need
install_dev_tools=true
install_python=true
install_nodejs=true # nodejs, npm, firebase-tools, pm2
install_gcloud=true
install_r=true
install_firebase=true
install_terraform=true
############################################################
################ common install git, vim, mc, ... ##############################################
sudo apt-get update
sudo apt-get install git mc vim curl jq uuid-runtime bc basez software-properties-common xmlstarlet rsync -y
################ dev tools ##############################################################
if [ "$install_dev_tools" == "true" ]
then
sudo apt-get install -y build-essential chrpath libssl-dev libxft-dev
sudo apt-get install -y libfreetype6 libfreetype6-dev
sudo apt-get install -y libfontconfig1 libfontconfig1-dev
fi
#################### python3 ###################
if [ "$install_python" == "true" ]
then
sudo apt-get install -y python3-pip python3
sudo apt-get install python3-venv
sudo pip3 install youtube-dl
pip3 install Flask gunicorn functions-framework
fi
#################### firebase ###################
if [ "$install_firebase" == "true" ]
then
curl -sL https://firebase.tools | bash
fi
################# R #######################################################
if [ "$install_r" == "true" ]
then
sudo apt-get install -y dirmngr apt-transport-https ca-certificates software-properties-common gnupg2
sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev
sudo apt-get install -y r-base r-base-dev
sudo R -e "install.packages('dplyr', repos='http://cran.rstudio.com/')"
sudo R -e "install.packages('tidyr', repos='http://cran.rstudio.com/')"
sudo R -e "install.packages('zoo', repos='http://cran.rstudio.com/')"
sudo R -e "install.packages('jsonlite', repos='http://cran.rstudio.com/')"
sudo R -e "install.packages('rvest', repos='http://cran.rstudio.com/')"
sudo R -e "install.packages('ggplow', repos='http://cran.rstudio.com/')"
fi
################ install nodejs, npm and pm2 enviroment, firebase and function-framework #################
if [ "$install_nodejs" == "true" ]
then
# installs fnm (Fast Node Manager)
curl -fsSL https://fnm.vercel.app/install | bash
# activate fnm
source ~/.bashrc
# download and install Node.js
fnm use --install-if-missing 22
# verifies the right Node.js version is in the environment
node -v # should print `v22.11.0`
# verifies the right npm version is in the environment
npm -v # should print `10.9.0`
fi
############### google cloud tools ######################################
if [ "$install_gcloud" == "true" ]
then
# Create environment variable for correct distribution
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
# Add the Cloud SDK distribution URI as a package source
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
# Import the Google Cloud Platform public key
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
# Update the package list and install the Cloud SDK
sudo apt-get update && sudo apt-get install -y google-cloud-sdk
fi
############### terraform and terragrunt
if [ "$install_terraform" == "true" ]
then
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install terraform
# TERRAGRUNT DONT WORK
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >>~/.bash_profile
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >>~/.profile
brew install terragrunt
fi
################
# set DISPLAY and better command line format
echo "export DISPLAY=:0" >> ~/.bashrc
echo "export PS1='\[\e]0;\u: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '" >> ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment