Author : MD TAREQ HASSAN | Updated : 2021/12/01

Chocholatey

Chocolatey is a package manager for windows (similar to homebrew in Mac or yum in Linux).

Installing chocholatey using Windows PowerShell

#
# PowerShell 5.1 comes with Windows by default
# Open Windows PowerShell as administrator
# command:
#
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Installing chocholatey using cmd

#
# Open cmd as as administrator
# command:
#
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

# Details: 
# https://docs.chocolatey.org/en-us/choco/setup

Upgrade

choco upgrade chocolatey -y

Version check

choco upgrade --noop

Uninstalling: https://community.chocolatey.org/courses/installation/uninstalling

PowerShell

See: PowerShell setup

Azure CLI

Install

# Using chocholatey
choco install azure-cli -y

# Using PowerShell
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi

# Using MSI installer (download and install):
# https://aka.ms/installazurecliwindows

Upgrade

az upgrade

Version check

az --version

Azure CloudShell

What is CloudShell?

Accessing CloudShell

Initial Setup

How to Use Manifest File in Command (i.e. to deploy K8s workload)

Re-mount fileshare

Connecting and running CloudShell in VSCode

Running Azure CloudShell Locally

PowerShell launcher script

C:\az-cloudshell\cloudshell-launcer.ps1

$startShellType = "/usr/bin/pwsh" # PowerShell, for bash -> "/bin/bash"
$cloudshellImageName = "mcr.microsoft.com/azure-cloudshell"

$sourceScriptFolder = "`"C:\az-cloudshell\scripts`""  # the folder where your local scrips are located, double quote is required ('`' to escape double quote)
$targetScriptFolder = "/usr/cloudshell"       # mounted folder in container 

$container = $(docker ps -q --filter ancestor=$cloudshellImageName)
$containerIsRunning = ($container -ne $null)

if ($containerIsRunning) { 

    Write-Host "Container is running. Connecting to container..."

    docker exec -it $container $startShellType

} else { 

    Write-Host "Container is not running. Updating container image..."

    docker pull "$($cloudshellImageName):latest"

    Write-Host "Mapping '$($sourceScriptFolder)' to '$($targetScriptFolder)'. Connecting to cloudshell (interactive)... `r`n`r`n"
    
    $volumeMount = "$($sourceScriptFolder):$($targetScriptFolder)"

    docker run -it -v $volumeMount mcr.microsoft.com/azure-cloudshell $startShellType
}

Create shortcut with following

"C:\Program Files\PowerShell\7\pwsh.exe" -ExecutionPolicy Bypass -File "C:\az-cloudshell\cloudshell-launcer.ps1"

Now right click on shortcut and run (as “Admin” if required)

To connect azure account, use Device Authentication: DeviceAuthentication - Connect Azure Account in CloudShell when MFA is Enabled

Windows Subsystem for Linux (WSL)

Do following for a fresh installation in Windows 11:

Installation

wsl Commands

wsl --install # retart

wsl --version

wsl -l -v
wsl --list --online
wsl --install -d ubuntu
wsl --update
wsl --status

wsl --set-version <distro name> 2
wsl --set-version Ubuntu 2

wsl --shutdown

Notes:

Global configuration:

.wslconfig

[wsl2]
memory=8GB
processors=4

[boot]
systemd=true

# https://learn.microsoft.com/en-us/windows/wsl/wsl-config#example-wslconfig-file

Using linux commands:

Access linux (i.e. Ubuntu) files

Docker

Choice of backend for Docker Desktop: docker can be installed using either of followings:

WSL2 backend

Hyper-V backend

Installing Docker in Azure Windows VM

Links

Minikube

Installation

choco install minikube -y

#
# cleanup
#
# minikube delete --all --purge
#

Minikube driver

minikube can be deployed:

Start minikube with Container (docker) driver

#
# 1. Set Docker Desktop resource quota
# Open "Run" > %UserProfile% > Create/Edit ".wslconfig" file (assuming docker backend is wsl)
# > set cpu, memory > save
# > restart PC (otherwise docker will be running with befault cpu and memory quota)
# 

#
# 2. Set docket as default driver
#
docker context use default # https://stackoverflow.com/a/77252383/4802664
minikube config set driver docker

#
# 3. minikube
# 
# minikube start --driver=docker
minikube delete # must delete the cluster before setting cpu & memory
minikube start
minikube start --cpus 4 --memory 8192 # Max docker RAM is set in ".wslconfig" file, so don't set RAM more than that
# Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default 

Start minikube with Hyper-V driver

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Tools-All -All

minikube start --driver=hyperv

#
# set docket as default driver
#
minikube config set driver hyperv

# minikube start --driver=hyperv --cpus <core count> --memory <n in MB>

minikube start --driver=hyperv --cpus 2 --memory 1800 (1800 MB -> minimum required by minikube)
minikube start --driver=hyperv --cpus 2 --memory 2090 (when 4GB RAM is used for hyper-v VM startup RAM)
minikube start --driver=hyperv --cpus 4 --memory 4096

#4GB -> 4096
#8GB -> 8192
#10GB -> 10240

minikube start --vm-driver hyperv --hyperv-virtual-switch "<switch name>"
minikube start --vm-driver hyperv --hyperv-virtual-switch "Primary Virtual Switch"
#(https://learn.microsoft.com/en-us/windows-server/virtualization/hyper-v/get-started/create-a-virtual-switch-for-hyper-v-virtual-machines?tabs=hyper-v-manager)

Once minikube is started, we can interact with it using kubectl:

Start minikube with Bare-metal driver

Note: The driver ‘none’ is not supported on windows/amd64

# 'none' is not supported on windows/amd64
minikube start --driver=none
minikube start --driver=none --cpus 4 --memory 8192 # 4 CPUs, 8GB RAM

#
# Set as default
#
minikube config set driver none

# https://minikube.sigs.k8s.io/docs/start/

Test local minikube cluster using kubectl

# On successfull start, you will get similar message to the following:
# Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default 

# if kubectl is not installed: minikube kubectl -- get pods -A
# If kubectl is already installed:
kubectl get pods -A
kubectl get nodes -o wide

Dashboard

# Enable metric server
minikube addons enable metrics-server

# Launch dashboard (will enable first if not enabled)
minikube dashboard

Stop minikube

minikube status
minikube stop

Pulumi

Install

# using chocolatey
choco install pulumi -y

# download and install:
# https://www.pulumi.com/docs/get-started/install/

Version check

pulumi version

Cmder

Install using chocholatey

# using chocolatey
choco install cmder -y

choco upgrade cmder

Open Cmder

Or download latest version and extract (put it in ‘C:\tools’): https://github.com/cmderdev/cmder/releases/

Note: use ‘/d’ to change directory i.e. “cd /d "

Connect Cmder to Azure

az aks login

Using Cmder to Interact with AKS Cluster

# if you are not logged in yet
az aks login

# get aks credential
az aks get-credentials --resource-group xyz-rg --name xyz-aks-cluster

AKS cluster Access Control

Once authenticated into AKS cluster, now execute kubectl commands

# make sure you set the correct namespace
kubectl config view --minify | grep namespace  # check namespace, for default namespace no value (empty) might be shown
kubectl config set-context --current --namespace xyz # set namespace

# Nodes
kubectl get nodes

# Pods
kubectl get pods

# Services
kubectl get svc

Kubectl

Install

# using chocolatey
choco install kubernetes-cli -y

choco upgrade kubernetes-cli

Version check

kubectl version --client

Helm

Install

# using chocolatey
choco install kubernetes-helm -y

Upgrade

choco upgrade kubernetes-helm -f -y

Add Helm to ‘Path’ environment variable

Check if Helm was istalled successfully (open PowerShell or cmd)

# you might need to restart your cmd/Cmder/Git Bash/PowerShell
helm version

NVM and Nodejs

Prerequisites:

Install NVM

# Open cmd or PowerShell ad Admin
choco install nvm -y

# or download and install (windows): https://github.com/coreybutler/nvm-windows#installation--upgrades

Install Nodejs using NVM

# Restart cmd or PowerShell
nvm install latest

# make latest as current
nvm use latest

# check
nvm current

# nvm ls

Check if nodejs is laready installed or not

node -v

npm

# check version
npm -v

# install
npm i -g npm # check again: npm -v

NVM in MAC

Run this in terminal:

touch ~/.bash_profile

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash

DO NOT forget to Restart your terminal. Now in the terminal, use command nvm --version and you should see the version.
See: https://stackoverflow.com/a/43037695

Angular CLI

Prerequisites:

Global installation

npm uninstall -g @angular/cli
npm cache clean --force
npm cache verify
npm install -g @angular/cli@latest

Local installation: Go to the priject folder and install local with --save-dev

rm -rf node_modules dist 
npm install --save-dev @angular/cli@latest
npm i 
ng update @angular/cli 
ng update @angular/core
npm install --save-dev @angular-devkit/build-angular

Install specific version

npm install -g @angular/cli@11.2.14

npm install --save-dev @angular/cli@11.2.14

Check version

ng version

Uninstall Angular CLI

npm uninstall -g @angular/cli
npm uninstall @angular/cli
npm cache clean --force

#
# If you installed specific version
# i.e. version 11.2.11
#
npm uninstall -g @angular/cli@11.2.11
npm uninstall @angular/cli@11.2.11
npm cache clean --force

jq

# make sure that chocholatey is already installed
choco install jq -y
# flag '-y' for accepting all

OpenSSL

#
# Check if already installed
#
openssl version

#
# Install
#
choco install openssl

Ruby and Jekyll

Install Ruby and DevKit

Install Jekyll

gem install jekyll bundler
jekyll -v

Create a Jekyll site:

Gemfile

# This will help ensure the proper Jekyll version is running.
gem 'jekyll'

# This is the default theme for new Jekyll sites. You may change this to anything you like.
# gem "minima", "~> 2.0"

# If you want to use GitHub Pages, remove the uncomment "gem jekyll" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
gem "github-pages", group: :jekyll_plugins

gem 'jekyll-theme-cayman', '~> 0.0.3'

# If you have any plugins, put them here!
#  gem 'jekyll-analytics'
group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.6"
  gem "jekyll-seo-tag"
  gem 'jekyll-toc', "<= 0.12.2"
  gem 'jekyll-commonmark-ghpages'
  gem "webrick", "~> 1.7"
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.0" if Gem.win_platform?

Install and update gems:

bundle install
bundle update
bundle update github-pages

Run locally:

bundle exec jekyll serve
bundle exec jekyll serve --livereload
bundle exec jekyll serve --watch
bundle exec jekyll serve --incremental
bundle exec jekyll serve --incremental --livereload
bundle exec jekyll serve --trace

SQL Server

choco install sql-server-2022
# check version: https://www.microsoft.com/en-us/sql-server/sql-server-downloads

SQL Server Management Studio

choco install sql-server-management-studio -y