Skip to content

Instantly share code, notes, and snippets.

@stungeye
Last active January 31, 2023 21:48
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save stungeye/4fd96987cbc9e0c6676e71cb14468660 to your computer and use it in GitHub Desktop.
Boxstarter Windows 10 Developer Setup - 2021 Edition

Enable Windows Developer Mode

Open the Windows Settings app, search for Developer Mode and enable it.

Install Boxstarter

Run Powershell as Admin and execute:

Set-ExecutionPolicy Unrestricted -Force
. { iwr -useb https://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force

Run Custom Boxstarter Script

Let's install a bunch of essential apps and tweak various Windows settings. Your machine will reboot a number of times during the boxstarter script. You'll need to be around to log back in so that the script can continue running. There's gotta be a way to temporarily disable logins until the end of the script, but I haven't figured that out yet.

From the Admin Powershell:

Install-BoxstarterPackage -PackageName https://link.to.raw.gist/your.boxstarter.ps1

Get the URL by clicking on the "Raw" button for the boxstarter2021.ps1 file found below.

Clone this gist if you want to customize the installed apps/tweaks in the boxstarter2021.ps1 script.

Upgrade WSL to WSL2

Follow the official instructions for upgrading from WSL to WSL2. Ensure that you download and isntall the kernel update package.

Install Ubuntu from Windows Store

Get the package called "Ubuntu" and it will install the latest LTS version.

If you installed Ubuntu before you upgraded to WSL2 then follow the install instructions and then in Powershell:

wsl --set-default-version 2
wsl --set-version ubuntu 2

Configure Terminal

Run Cmder once from the start menu, so that it sets itself up.

Then from the Terminal settings.json file (accessible from Terminal Settings menu):

"profiles": 
{
    "defaults": {
        "fontFace": "Cascadia Mono",
        "fontSize": 12,
        "padding": "15",
    },
    "list": 
    [            
        {
            "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
            "hidden": false,
            "name": "Ubuntu",
            "source": "Windows.Terminal.Wsl"
        },             
        {
            "guid": "{6d953325-a939-475d-a151-940cbd0302fb}",
            "name": "Cmder",
            "commandline": "cmd.exe /k c:\\tools\\Cmder\\vendor\\init.bat",
            "startingDirectory": "%USERPROFILE%",
            "icon": "c:\\tools\\Cmder\\icons\\cmder.ico",
            
          },
        {
            "commandline": "powershell.exe",
            "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
            "hidden": false,
            "name": "Windows PowerShell"
        },
        {
            "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
            "hidden": false,
            "name": "Azure Cloud Shell",
            "source": "Windows.Terminal.Azure"
        },


    ]
},

Update the font settings, the defaultProfile GUID, and re-order the profiles list to suite your taste.

Configure Git

The following should be done in Terminal Cmder and in the WSL Bash:

  • git config --global color.ui true
  • git config --global user.name "Your Name"
  • git config --global user.email "your@email.com"
  • ssh-keygen -t rsa -C "your@email.com"

After doing this run:

  • cat "%USERPROFILE%\.ssh\id_rsa.pub" (Windows)
  • cat ~/.ssh/id_rsa.pub (WSL)

Add the output of each command as a new SSH Key in your GitHub settings.

Install VS Code Plugins

  • Remote - WSL
  • Remote - SSH
  • Simple Icons
  • C/C++
  • Bracket Pair Colorizer 2
  • Prettier
  • Code Runner
  • ESLint
  • html tag wrapper (wrap selected html tag by pressing ctrl+i)
  • PHP Intelephense
  • REST Client
  • Ruby
  • ruby-rubocop
  • Ruby Solargraph
  • sqlite
  • sass
  • endwise
  • Visual Studio IntelliCode
  • Vim
  • Live Server
  • Code Spell Check
  • Grammarly (unofficial)
  • Markdown Preview Enhanced
  • p5.vscode

Vs Code User Settings

Ctrl-Shift-P: Open Settings Json

{
    "files.trimTrailingWhitespace": true,
    "files.autoSave": "afterDelay",

    "editor.formatOnSave": true,
    "editor.suggestSelection": "first",
    "editor.mouseWheelZoom": true,

    "git.ignoreLegacyWarning": true,

    "ruby.intellisense": false, // Let solargraph handle it.
    "ruby.format": "rubocop",
    "ruby.lint": {
        "rubocop": true
    },

    "[markdown]": {
        "files.trimTrailingWhitespace": false
    },

    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "terminal.integrated.defaultProfile.windows": "Ubuntu (WSL)",
}

Configure Exercism

From Terminal (Powershell):

  • exercism configure --token=your_token
  • git clone git@github.com:stungeye/Exercism-Praxis.git C:\Users\kgeske\Exercism

Install Node, NPM, Ruby and Rails in WSL

  • cd ~
  • sudo apt update
  • sudo apt upgrade
  • curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
  • sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev libpq-dev nodejs
  • git clone https://github.com/rbenv/rbenv.git ~/.rbenv
  • echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
  • echo 'eval "$(rbenv init -)"' >> ~/.bashrc
  • git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
  • echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
  • source ~/.bashrc
  • rbenv install 3.0.1
  • rbenv global 3.0.1
  • gem install rails

And if you want the Starship fancy prompt:

  • sh -c "$(curl -fsSL https://starship.rs/install.sh)"
  • echo 'eval "$(starship init bash)"' >> ~/.bashrc

Sign-In to Google Chrome and Firefox

This should automatically install all your required extensions.

Open Task Manager Startup Tab

Sort by enabled. Disable most of the cruft. Experiment, you can always re-enabled anything you disable.

### HACK Workaround choco / boxstarter path too long error
## https://github.com/chocolatey/boxstarter/issues/241
$ChocoCachePath = "$env:USERPROFILE\AppData\Local\Temp\chocolatey"
New-Item -Path $ChocoCachePath -ItemType Directory -Force
$cup = 'choco upgrade --cacheLocation="$ChocoCachePath"'
######################################
#### make sure we're not bothered ####
######################################
Disable-UAC
# Show more info for files in Explorer
Set-WindowsExplorerOptions -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar -EnableShowHiddenFilesFoldersDrives
# Allow running PowerShell scripts
Update-ExecutionPolicy Unrestricted
$Boxstarter.RebootOk=$true
# Update Windows and reboot if necessary
Install-WindowsUpdate -AcceptEula
if (Test-PendingReboot) { Invoke-Reboot }
# Dev tools
Invoke-Expression "$cup cmder"
Invoke-Expression "$cup vscode"
Invoke-Expression "$cup microsoft-windows-terminal"
Invoke-Expression "$cup heidisql"
Invoke-Expression "$cup git.install"
# Browser
Invoke-Expression "$cup googlechrome"
Invoke-Expression "$cup firefox"
cinst wsl # Requires Windows Dev Mode
# Other essential goods
Invoke-Expression "$cup lastpass"
Invoke-Expression "$cup 7zip"
Invoke-Expression "$cup cyberduck"
Invoke-Expression "$cup windirstat"
Invoke-Expression "$cup exercism-io-cli"
Invoke-Expression "$cup sysinternals"
Invoke-Expression "$cup foxitreader"
Invoke-Expression "$cup sharex"
Invoke-Expression "$cup hwinfo"
Invoke-Expression "$cup cpu-z"
Invoke-Expression "$cup ccleaner"
Invoke-Expression "$cup powertoys"
Invoke-Expression "$cup screentogif"
Invoke-Expression "$cup spotify"
Invoke-Expression "$cup paint.net"
# Chatty Chat
Invoke-Expression "$cup microsoft-teams"
Invoke-Expression "$cup discord"
Invoke-Expression "$cup zoom"
Invoke-Expression "$cup signal"
Invoke-Expression "$cup obs-studio"
# Fun
Invoke-Expression "$cup vlc"
Invoke-Expression "$cup audacity"
Invoke-Expression "$cup audacity-lame"
#Fonts
Invoke-Expression "$cup FiraCode"
Invoke-Expression "$cup hackfont"
Invoke-Expression "$cup sourcecodepro"
Invoke-Expression "$cup cascadiacode"
# Configure windows Hyper-V virtualization
choco install Microsoft-Hyper-V-All -source windowsFeatures
choco install Microsoft-Windows-Subsystem-Linux -source windowsfeatures
# No SMB1 - https://blogs.technet.microsoft.com/filecab/2016/09/16/stop-using-smb1/
Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol
# Start Menu: Disable Bing Search Results
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Name BingSearchEnabled -Type DWord -Value 0
# To Restore (Enabled):
# Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Name BingSearchEnabled -Type DWord -Value 1
# Change Explorer home screen back to "This PC"
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Type DWord -Value 1
# Change it back to "Quick Access" (Windows 10 default)
# Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Type DWord -Value 2
if (Test-PendingReboot) { Invoke-Reboot }
# Cleanup
del C:\eula*.txt
del C:\install.*
del C:\vcredist.*
del C:\vc_red.*
################################
#### restore disabled stuff ####
################################
Enable-UAC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment