Last active
September 22, 2024 21:49
-
-
Save raelyard/6783972a17ba1bc14e83 to your computer and use it in GitHub Desktop.
New Dev Machine Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb | |
sudo dpkg -i packages-microsoft-prod.deb | |
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null | |
curl -sL https://packages.microsoft.com/keys/microsoft.asc | | |
gpg --dearmor | | |
sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null | |
AZ_REPO=$(lsb_release -cs) | |
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | | |
sudo tee /etc/apt/sources.list.d/azure-cli.list | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list | |
sudo apt update | |
sudo apt install -y apt-transport-https | |
sudo add-apt-repository ppa:git-core/ppa | |
sudo apt update | |
sudo apt install -y git | |
sudo apt upgrade-dist -y | |
sudo apt install -y build-essential libssl-dev | |
sudo apt install -y net-tools | |
sudo apt install -y unzip | |
sudo apt install -y nginx | |
sudo apt install -y azure-cli | |
sudo apt install -y awscli | |
sudo apt install -y lastpass-cli | |
sudo apt install -y jq | |
sudo apt install helm | |
# Azure Kubernetes Service authentication tool for Azure Active Directory | |
# (use `kubelogin convert-kubeconfig -l azurecli` after authenticating with a cluster with az `az aks get-credentials -g <resource group> -n <cluster>`) | |
wget https://github.com/Azure/kubelogin/releases/download/v0.0.28/kubelogin-linux-amd64.zip | |
unzip kubelogin-linux-amd64.zip | |
rm kubelogin-linux-amd64.zip | |
sudo mv bin/linux_amd64/kubelogin /usr/bin | |
kubelogin convert-kubeconfig -l azurecli | |
# Azure Artifacts Credential Provider | |
wget -qO- https://aka.ms/install-artifacts-credprovider.sh | bash | |
az config set auto-upgrade.enable=yes | |
# tfenv to enable setting up different versions of terraform (and installing and setting latest as default) | |
git clone https://github.com/tfutils/tfenv.git ~/.tfenv | |
sudo ln -s ~/.tfenv/bin/* /usr/local/bin | |
tfenv install latest | |
tfenv use latest | |
sudo apt install -y dotnet-sdk-8.0 | |
sudo apt-get install -y powershell | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash | |
source ~/.profile | |
nvm install node | |
nvm use node | |
rm packages-microsoft-prod.deb | |
# Kind for clusters with Docker container nodes | |
curl -Lo ./kind "https://kind.sigs.k8s.io/dl/v0.17.0/kind-$(uname)-amd64" | |
chmod +x ./kind | |
sudo mv ./kind /usr/local/bin/kind | |
# set up a local Nuget package source | |
mkdir ~/packages | |
nuget source add -Name Local -source ~/packages | |
# configure git identity and defaults (want to prune on fetch, etc.) | |
git config --global credential.helper 'cache --timeout 3600' | |
git config --global user.name "Dave Rael" | |
git config --global user.email "dave@raelyard.com" | |
git config --global fetch.prune true | |
git config --global push.default upstream | |
# make WinMerge my git difftool tool of choice | |
git config --global diff.tool "winmerge" | |
git config --global difftool.prompt "false" | |
git config --global difftool.winmerge.cmd '/mnt/c/Program\ Files/WinMerge/WinMergeU.exe -e -u -x -wl -dl base "$(wslpath -aw $LOCAL)" "$(wslpath -aw $REMOTE)"' | |
# useful git log aliases | |
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset %Cgreen%cd%Creset %s %C(bold blue)<%an>%Creset %C(auto)%D%Creset' --abbrev-commit --date local --date=format:'%Y-%m-%d %H:%M'" | |
git config --global alias.lgf 'lg --first-parent' | |
git config --global alias.lgfr 'lgf -20' | |
git config --global alias.lgr 'lg -20' | |
# keep sftp and ssh sessions alive https://superuser.com/questions/699676/how-to-prevent-ssh-from-disconnecting-if-its-been-idle-for-a-while/699680#699680 | |
mkdir -p ~/.ssh | |
echo "ServerAliveInterval 60" >> ~/.ssh/config | |
sudo apt install zsh -y | |
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to execute: | |
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force | |
# Install-BoxstarterPackage -PackageName https://gist.githubusercontent.com/raelyard/6783972a17ba1bc14e83/raw/ -DisableReboots | |
Disable-MicrosoftUpdate | |
Disable-UAC | |
choco feature enable -n=allowGlobalConfirmation | |
powercfg /change standby-timeout-ac 0 | |
powercfg /change standby-timeout-dc 0 | |
powercfg /change hibernate-timeout-ac 0 | |
powercfg /change hibernate-timeout-dc 0 | |
# Windows Explorer has undesirable defaults - fix for this installation: | |
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar -DisableOpenFileExplorerToQuickAccess -EnableShowFrequentFoldersInQuickAccess | |
# Windows Subsystem For Linux | |
choco install -y Microsoft-Windows-Subsystem-Linux -source WindowsFeatures | |
wsl --update | |
# Hyper-V, .NET, IIS and friends | |
choco install -y Microsoft-Hyper-V-All -source WindowsFeatures | |
choco install -y Containers -source WindowsFeatures | |
choco install -y dotnetfx | |
choco install -y IIS-WebServerRole -source WindowsFeatures | |
choco install -y IIS-WebServer -source WindowsFeatures | |
choco install -y IIS-Security -source WindowsFeatures | |
choco install -y IIS-BasicAuthentication -source WindowsFeatures | |
choco install -y IIS-DefaultDocument -source WindowsFeatures | |
choco install -y IIS-DigestAuthentication -source WindowsFeatures | |
choco install -y IIS-DirectoryBrowsing -source WindowsFeatures | |
choco install -y IIS-ASPNET -source WindowsFeatures | |
choco install -y IIS-HttpRedirect -source WindowsFeatures | |
choco install -y IIS-ApplicationInit -source WindowsFeatures | |
choco install -y IIS-RequestFiltering -source WindowsFeatures | |
choco install -y IIS-RequestMonitor -source WindowsFeatures | |
choco install -y IIS-StaticContent -source WindowsFeatures | |
choco install -y IIS-HttpCompressionStatic -source WindowsFeatures | |
choco install -y IIS-HttpCompressionDynamic -source WindowsFeatures | |
choco install -y IIS-HttpTracing -source WindowsFeatures | |
choco install -y IIS-WindowsAuthentication -source WindowsFeatures | |
choco install -y IIS-WebSockets -source WindowsFeatures | |
# now start the software packages | |
choco install -y git | |
choco install -y powershell-core | |
choco install -y microsoft-edge | |
choco install -y googlechrome | |
choco install -y 7Zip | |
choco install -y audacity | |
choco install -y audacity-lame | |
choco install -y audacity-ffmpeg | |
choco install -y awscli | |
choco install -y azure-cli | |
choco install -y AzureStorageExplorer | |
choco install -y ConEmu | |
choco install -y curl | |
choco install -y docker-desktop | |
choco install -y dropbox | |
choco install -y electrum | |
choco install -y evernote | |
choco install -y fiddler | |
choco install -y firefox | |
choco install -y vim | |
choco install -y kindle | |
choco install -y lockhunter | |
choco install -y ngrok.portable | |
choco install -y nvm | |
choco install -y notepadplusplus | |
choco install -y nuget.commandline | |
choco install -y papercut | |
choco install -y poshgit | |
choco install -y Posh-HG | |
choco install -y powertoys | |
choco install -y Roundhouse | |
choco install -y sendtokindle | |
choco install -y Slack | |
choco install -y sysinternals | |
choco install -y visualstudiocode | |
choco install -y windirstat | |
choco install -y winmerge | |
RefreshEnv | |
az config set auto-upgrade.enable=yes | |
# Visual Studio and friends | |
choco install -y visualstudio2022professional --package-parameters "--allWorkloads --includeRecommended --passive --locale en-US" | |
choco install -y resharper | |
choco install -y sql-server-management-studio | |
# set up a local Nuget package source | |
new-item C:\packages -type directory | |
nuget source add -Name Local -source C:\packages | |
# configure git identity and defaults (want to prune on fetch, etc.) | |
git config --global user.name "Dave Rael" | |
git config --global user.email "dave@raelyard.com" | |
git config --global fetch.prune true | |
git config --global push.default upstream | |
# make WinMerge my git difftool tool of choice | |
git config --global diff.tool "winmerge" | |
git config --global difftool.prompt "false" | |
git config --global difftool.winmerge.cmd 'winmergeu.exe -e -u -x -wl -dl base \"$LOCAL\" \"$REMOTE\"' | |
# but also set config to switch to other difftool/mergetool options to switch when desired | |
git config --global difftool.vsdiffmerge.cmd '\"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsdiffmerge.exe\" \"$LOCAL\" \"$REMOTE\" //t' | |
git config --global mergetool.vsdiffmerge.cmd '\"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsdiffmerge.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" //m' | |
# useful git log aliases | |
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset %Cgreen%cd%Creset %s %C(bold blue)<%an>%Creset %C(auto)%D%Creset' --abbrev-commit --date local --date=format:'%Y-%m-%d %H:%M'" | |
git config --global alias.lgf 'lg --first-parent' | |
git config --global alias.lgfr 'lgf -20' | |
git config --global alias.lgr 'lg -20' | |
# grab my standard configuration | |
new-item C:\Code -type directory | |
set-location C:\Code | |
git clone https://github.com/raelyard/setup | |
set-location Setup\PowerShell | |
.\SetPowerShellProfile.ps1 | |
refreshenv | |
. C:\Code\setup\Powershell\Functions\Windows.ps1 | |
Append-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin" | |
nvm install lts | |
nvm use lts | |
Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu.appx -UseBasicParsing | |
Add-AppxPackage .\Ubuntu.appx | |
rm .\Ubuntu.appx | |
RefreshEnv | |
Ubuntu install --root | |
RefreshEnv | |
if ((Ubuntu run getent passwd | Select-String -Pattern '^raelyard' -AllMatches).Matches.Count -ne 1) { | |
Ubuntu run apt update | |
# Create passwordless raelyard | |
Ubuntu run 'useradd -m -s /bin/bash raelyard' | |
Ubuntu run 'usermod -aG sudo raelyard' | |
# supress password prompts from sudo commands | |
Ubuntu run "echo 'raelyard ALL=(ALL) NOPASSWD: ALL' | sudo EDITOR='tee -a' visudo" | |
# Switch default user from root to raelyard | |
Ubuntu config --default-user raelyard | |
} | |
# Copy and run provisioning script as raelyard | |
# sudo is can be used and script MUST be repeatable! | |
$WSLProvisionURL = "https://gist.githubusercontent.com/raelyard/6783972a17ba1bc14e83/raw/machine-setup.sh" | |
$WSLProvision = (Invoke-WebRequest -UseBasicParsing "$WSLProvisionURL").Content.Replace("{{home_folder}}", $Home.Replace("\", "/").Replace("C:/", "/mnt/c/")) | |
$WSLProvision | Ubuntu run 'cat - > /home/raelyard/provision.sh' | |
Ubuntu run 'chmod +x /home/raelyard/provision.sh' | |
Ubuntu run '/home/raelyard/provision.sh' | |
wsl --set-default Ubuntu | |
Enable-UAC | |
Enable-MicrosoftUpdate | |
$Updates = Start-WUScan -SearchCriteria "Type='Software' AND IsInstalled=0" | |
Install-WindowsUpdate -Full |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to execute: | |
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force | |
# Install-BoxstarterPackage -PackageName https://gist.githubusercontent.com/raelyard/6783972a17ba1bc14e83/raw/Minimal.ps1 -DisableReboots | |
Disable-MicrosoftUpdate | |
Disable-UAC | |
choco feature enable -n=allowGlobalConfirmation | |
powercfg /change standby-timeout-ac 0 | |
powercfg /change standby-timeout-dc 0 | |
powercfg /change hibernate-timeout-ac 0 | |
powercfg /change hibernate-timeout-dc 0 | |
# Windows Explorer has undesirable defaults - fix for this installation: | |
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar -DisableOpenFileExplorerToQuickAccess -EnableShowFrequentFoldersInQuickAccess | |
# Windows Subsystem For Linux | |
choco install -y Microsoft-Windows-Subsystem-Linux -source WindowsFeatures | |
# essential software packages | |
choco install -y git | |
choco install -y docker-desktop | |
choco install -y vim | |
choco install -y powershell-core | |
choco install -y visualstudiocode | |
choco install -y ngrok.portable | |
choco install -y ConEmu | |
choco install -y dropbox | |
choco install -y winmerge | |
RefreshEnv | |
# configure git identity and defaults (want to prune on fetch, etc.) | |
git config --global user.name "Dave Rael" | |
git config --global user.email "dave@raelyard.com" | |
git config --global fetch.prune true | |
git config --global push.default upstream | |
# make WinMerge my git difftool tool of choice | |
git config --global diff.tool "winmerge" | |
git config --global difftool.prompt "false" | |
git config --global difftool.winmerge.cmd 'winmergeu.exe -e -u -x -wl -dl base \"$LOCAL\" \"$REMOTE\"' | |
# but also set config to switch to other difftool/mergetool options to switch when desired | |
git config --global difftool.vsdiffmerge.cmd '\"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsdiffmerge.exe\" \"$LOCAL\" \"$REMOTE\" //t' | |
git config --global mergetool.vsdiffmerge.cmd '\"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsdiffmerge.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" //m' | |
# useful git log aliases | |
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset %Cgreen%cd%Creset %s %C(bold blue)<%an>%Creset %C(auto)%D%Creset' --abbrev-commit --date local --date=format:'%Y-%m-%d %H:%M'" | |
git config --global alias.lgf 'lg --first-parent' | |
git config --global alias.lgfr 'lgf -20' | |
git config --global alias.lgr 'lg -20' | |
Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu.appx -UseBasicParsing | |
Add-AppxPackage .\Ubuntu.appx | |
rm .\Ubuntu.appx | |
RefreshEnv | |
Ubuntu install --root | |
RefreshEnv | |
if ((Ubuntu run getent passwd | Select-String -Pattern '^raelyard' -AllMatches).Matches.Count -ne 1) { | |
Ubuntu run apt update | |
# Create passwordless raelyard | |
Ubuntu run 'useradd -m -s /bin/bash raelyard' | |
Ubuntu run 'usermod -aG sudo raelyard' | |
# supress password prompts from sudo commands | |
Ubuntu run "echo 'raelyard ALL=(ALL) NOPASSWD: ALL' | sudo EDITOR='tee -a' visudo" | |
# Switch default user from root to raelyard | |
Ubuntu config --default-user raelyard | |
} | |
# Copy and run provisioning script as raelyard | |
# sudo is can be used and script MUST be repeatable! | |
$WSLProvisionURL = "https://gist.githubusercontent.com/raelyard/6783972a17ba1bc14e83/raw/machine-setup.sh" | |
$WSLProvision = (Invoke-WebRequest -UseBasicParsing "$WSLProvisionURL").Content.Replace("{{home_folder}}", $Home.Replace("\", "/").Replace("C:/", "/mnt/c/")) | |
$WSLProvision | Ubuntu run 'cat - > /home/raelyard/provision.sh' | |
Ubuntu run 'chmod +x /home/raelyard/provision.sh' | |
Ubuntu run '/home/raelyard/provision.sh' | |
Enable-UAC | |
Enable-MicrosoftUpdate | |
Install-WindowsUpdate -Full | |
# now start the other software packages | |
choco install -y googlechrome | |
choco install -y 7Zip | |
choco install -y curl | |
choco install -y evernote | |
choco install -y fiddler | |
choco install -y firefox | |
choco install -y kindle | |
choco install -y lockhunter | |
choco install -y notepadplusplus | |
choco install -y poshgit | |
choco install -y Slack | |
choco install -y sysinternals | |
choco install -y windirstat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment