Skip to content

Instantly share code, notes, and snippets.

@nissan

nissan/setup-laptop.ps1

Last active Oct 20, 2020
Embed
What would you like to do?
# Author: Nissan Dookeran
# Email: nissan.dookeran@gmail.com
# Date Last Updated: 20-Oct-2020.
# Run from elevated Powershell prompt (Run as Administrator)
#Install Windows subsystem for Linux, upgrade to V2
#reference https://docs.microsoft.com/en-us/windows/wsl/install-win10
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
#will need to restart here
# always use V2 by default of Windows Subsystem for Linux
wsl --set-default-version 2
# Install chocolatey package manager to manage software installations from command line
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
refreshenv
# - GoogleChrome because everyone uses this browser. Can also optionally add Firefox if needed but don't really use it that often these days
choco install -y googlechrome # firefox
# - powershell-core is the future of Powershell, probably better to start using this right away
# - git for version management.
choco install -y powershell-core git git-credential-manager-for-windows
# may want to exit powershell after this if running manually, and start a powershell-core prompt instead to continue
# Once installed git should be configured with
# git config --global user.name "User Name"
# git config --global user.email "user@domain.com"
# - vscode has extensions saved using "Settings Sync" extension, so add this manually, then use it to login to Github and pull the
# public gist already setup with all extensions for VSCode configured (or setup new one if never used before)
# - firacode to install the font that enables ligatures in VSCode. Configuration steps at https://github.com/tonsky/FiraCode/wiki/VS-Code-Instructions
# - vscode-settingsync since all other vscode extensions can be loaded from the private gist after and synced across machines
choco install -y vscode vscode-settingssync firacode
# - nvs for managing different node versions
# - nodejs is installed since even though we are going to use nvs to manage which version of Node is running, without nodejs installed
# first there will be an error running node or npm from a Powershell prompt
# - yarn installed separate from node/npm as it runs well on its own without being tied to a node/npm version
choco install -y nodejs nvs yarn
# - dotnetcore-sdk installs latest version (3.x) but if you want a older version in parallel should download and install using
# `choco install dotnetcore-sdk --version=2.2.x` for example and then run `choco upgrade all -y` to get it to up to 3.x
# - azure-cli since Azure CLI is the future for upping and scripting Azure components
# - azure-data-studio since more lightweight than full Sql Server Management Studio, and is the future for simple dev tasks
# - sql-server-management-studio is installed though as azure-data-studio not quite on feature parity to fully replaces it
choco install -y dotnetcore-sdk azure-cli azure-data-studio sql-server-management-studio
# - docker-desktop requires you to log out and log back in for permissions to be set correctly.
# Also you should have a dockerhub login to pull images
# Easy way to get containers and a kubernetes environment going
choco install -y docker-desktop
# - anaconda3 to get different python environments setup for some data automation tasks
# Also anaconda also would let me setup an R environment for Jupyter Notebooks quite easily as well
choco install -y anaconda3
# May require reboot before running
#Reference https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-3.4.0
Install-Module -Name Az -AllowClobber -Scope AllUsers
Connect-AzAccount
# Add https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator manually
# Add unix utils for windows
# Installs bc-1.05, bison-1.28, bzip2-1.0.2, diffutils-2.7, fileutils-3.16, findutils-4.1, flex-2.5.4, gawk-3.1.0,
# grep-2.4.2, gsar110, gzip-1.2.4, indent-2.2.9, jwhois-2.4.1, less-340, m4-1.4, make-3.78.1, patch-2.5, recode-3.6,
# rman-3.0.7, sed-3.02, shellutils-1.9.4, tar-1.12, textutils-2.1, unrar-3.00, wget-1.8.2, which-2.4,
choco install -y unxUtils
# Minikube to follow along tutorial at https://kubernetes.io/docs/tutorials/hello-minikube/
choco install -y minikube
#eslint install globally to avoid problems with vscode linting
yarn global add eslint
# CRA for standing up new react projects quickly
yarn global add create-react-app
# open-cli lets you open files from command prompt. comes in handy at times
yarn global add open-cli
# using katacoda for learning
yarn global add katacoda-cli
# Note go to visualstudio.com and install VS Community/Pro/Ent as licensed. The VS Installer here does a better job than chocolatey
# but we run all these packages so no need to install again some of what is optional
Install-Module PowershellGet -Force
# posh-git is a PowerShell module that integrates Git and PowerShell
# by providing Git status summary information that can be displayed in the PowerShell prompt
choco install -y poshgit
Import-Module C:\tools\poshgit\dahlbyk-posh-git-9bda399\src\posh-git.psd1
Add-PoshGitToProfile
# Install .NET interactive
#.NET interactive is a group of CLI tools and APIs that enable users
# to create interactive experiences across the web, markdown, and notebooks.
# https://github.com/dotnet/interactive
# dotnet tool install -g --add-source "https://dotnet.myget.org/F/dotnet-try/api/v3/index.json" Microsoft.dotnet-interactive
dotnet tool install --global Microsoft.dotnet-interactive
# may need to run this from anaconda prompt to work successfully, try to run:
# jupyter kernelspec list
# if this fails switch to anaconda prompt and run from there
# TODO: Find a way to load anaconda prompt values in powershell so this command works at PS prompt
dotnet interactive jupyter install
#Install Remote Desktop Connection Manager
# More useful over normal RDP as it lets you group RDP connections)
choco install -y rdcman
#PostMan - for testing
choco install -y postman
#Install julia
choco install -y julia
# Follow https://datatofish.com/add-julia-to-jupyter/ to add it as jupyter kernel
# Install EF Core (separate install as of .NET Core 3.0)
dotnet tool install --global dotnet-ef
# Install R standalone
choco install -y R.Project
# Follow https://docs.anaconda.com/anaconda/navigator/tutorials/r-lang/ to add it as a jupyter kernel
# Another reference at https://datatofish.com/r-jupyter-notebook/
# To do it from R command prompt check https://developers.refinitiv.com/article/setup-jupyter-notebook-r
# add typescript/javascript support as a jupyter kernel, reference https://github.com/yunabe/tslab
yarn global add typescript
yarn global add tslab
tslab install --version
tslab install
#Install Go language, add it as a jupyter kernel, reference https://github.com/gopherdata/gophernotes
choco install -y golang
go get github.com/gopherdata/gophernotes
mkdir $env:APPDATA\jupyter\kernels\gophernotes
xcopy $env:GOPATH\src\github.com\gopherdata\gophernotes\kernel $env:APPDATA\jupyter\kernels\gophernotes /s
#Install Elixir, add it as a jupyter kernel, reference https://github.com/pprzetacznik/IElixir
# choco install -y elixir
# git clone https://github.com/pprzetacznik/IElixir.git
# cd IElixir
# mix deps.get
# mix test # fails here, needs C++ libraries TODO: Figure out which build to install
# Also, may need to switch to Visual Studio Developer Console to get access to C++ compiler in path
#setup mongo as a docker image
#reference https://www.thepolyglotdeveloper.com/2019/01/getting-started-mongodb-docker-container-deployment/
# and
choco install -y robo3t # browser for mongo
docker login
docker pull mongo:bionic
docker run --name mongodb --rm -d -p 27017-27019:27017-27019 -v c:\mongodb\data\db:/data/db mongo:bionic
# pip install imongo-kernel #doesn't work to setup the kernel though. Reference https://github.com/gusutabopb/imongo
#setup Microsoft SQL Server on Linux as a docker image
docker pull mcr.microsoft.com/mssql/server:2019-CU5-ubuntu-16.04
#create volumes to persist data in container between runs
# from https://dbafromthecold.com/2019/03/21/using-docker-named-volumes-to-persist-databases-in-sql-server/
# reference https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-configure-docker?view=sql-server-ver15#mount-a-host-directory-as-data-volume
# docker volume create mssqlsystem
# docker volume create mssqluser
# docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-CU5-ubuntu-16.04 --volume mssqlsystem:/var/opt/mssql --volume mssqluser:/var/opt/sqlserver
# docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=P@ssw0rd123$" -p 1433:1433 -v /data:/var/opt/mssql/data -v /log:/var/opt/mssql/log -v /secrets:/var/opt/mssql/secrets -d mcr.microsoft.com/mssql/server:2019-CU5-ubuntu-16.04
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=<YourStrong!Passw0rd>" -p 1433:1433 -v c:\sqldata\data:/var/opt/mssql/data -v c:\data\log:/var/opt/mssql/log -v c:\data\secrets:/var/opt/mssql/secrets -d mcr.microsoft.com/mssql/server:2019-CU5-ubuntu-16.04
#Following https://docs.microsoft.com/en-us/windows/win32/direct3d12/gpu-cuda-in-wsl to setup CUDA GPU support in WSL2
#TODO
#Start-SEQ containers with GELF and Syslog ingestion
#Pre-requisite to this - ensure https://gist.github.com/nissan/e44c6768c3efba327db33ece8091bf30 is copied to path as ` docker-compose.seq.yml`
wget https://gist.githubusercontent.com/nissan/e44c6768c3efba327db33ece8091bf30/raw/ecc6fed7398405c170ad818e1d45f531f7e8f32e/docker-compose-seq.yml
docker-compose -f docker-compose.seq.yml up
#Start RabbitMQ docker container and push logs for container and rabbitmq to SEQ ingestion
docker run -it --rm --name rabbitmq -p 6672:5672 -p 15672:15672 --log-driver gelf --log-opt gelf-address=udp://localhost:12201 rabbitmq:3-management
# Add Vue CLI requirements for instant prototyping ref:https://cli.vuejs.org/guide/prototyping.html
yarn global add @vue/cli @vue/cli-service-global
@nissan

This comment has been minimized.

Copy link
Owner Author

@nissan nissan commented Feb 10, 2020

Add Azure PowerShell installation as post-install software step

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment