Setup a Windows developer workstation in corporate environment - ASAP.
- Corporate laptop issued, OS baseline configured already and managed externally
- WSL 2 + Ubuntu FTW!
- Most stuff runs inside WSL, set it as the default shell and install utils such as terraform, gcloud, awscli inside WSL
- Some things have to run on the host in powershell - like vagrant <<<--- fixme!
- All scripts run as
administrator
in powershell - Remember the
.\
is backwards on Windows - Apply all Windows updates first
- If something doesnt work try rebooting
BIOS/UEFI is locked. To swap FN and CTRL login to Windows, press F11 to access Lenovo Keyboard Manager. There is a switch if you scroll down to swap these two buttons
- Install chocolatey
- Choose
individual
- Copy-paste the powershell codes into an
Adminstrator
powershell terminal
- Choose
choco install firefox vscode git
Stop git breaking line endings:
git config --global core.autocrlf false
Open new powershell terminal as user and clone the repo somewhere:
git clone https://github.com/GeoffWilliams/windowsnow.git
Set-ExecutionPolicy -ExecutionPolicy Bypass
cd \this\repo
.\setmeup.ps1
Reboot as needed
After install, some setups to do
- Unfortunately not in taskbar (xmeters does this but doesnt work with Windows 11 - author contacted)
- Provided through chocolatey package:
8gadgets
. Startgadgets
and you get a separate giant panel which you can add a monitor to - Start
8gadgets
, choose run at startup and add the widgets you want to monitor system
- Start Docker Desktop, accept the licence
- Login with your personal Docker ID, ask IT to add your Docker ID to the corporate account
- resources -> WSL integration -> enable ubuntu integration
- Test (check powershell terminal and ubuntu - use
windows terminal
):docker run hello-world
- See notes on WSL Integration
wsl --set-default Ubuntu
In the above steps, WSL and Ubuntu were installed. After reboot, setup Windows Terminal to boot Ubuntu by defualt:
- Launch terminal
- Arrow down menu
- Settings
- Default Profile -> Ubuntu
- Save and reopen. Should now be in Ubuntu shell
Now you can setup Ubuntu. Some apps like az
run "magically" from windows inside WSL but most dont, so run the next script inside Ubuntu - you can launch terminal from inside VS code editing this project and you will be in the right place otherwise your Windows system files are at /mnt/c
:
sudo ./setup_system.sh
You will need to reboot WSL2, see notes at bottom of this file.
Required by xdg-open-wsl and probably other things too:
First install pyenv:
./setup_pyenv.sh
Logout, log back in again, install python:
./setup_python.sh
Logout, log back in again.
Install user apps and settings, run this script as yourself:
./setup_user.sh
The script is idempotent so run as many times as you like.
Ubuntu terminal as default:
- File->Preferences->Settings
- Feature->Terminal
- Terminal: Explorer Kind -> external
- Terminal › External: Windows Exec -> wt
- Terminal › Integrated › Default Profile: Windows > Ubuntu (WSL)
Close, restart code. Should now have Ubuntu terminal on click
- Settings -> Tools -> Terminal -> Shell path ->
wsl --distribution Ubuntu
- You have a service bound to a port on WSL2/Ubuntu
- You want to access this port from Windows - eg in web browser
but use the script in this repo as the execution target: wsl2_port_forward.ps1
Ill just leave this here... If your system administrator cares about this future group policy updates will re-enable things:
Run in powershell:
wsl --shutdown ; wsl -d ubuntu
- Powershell 5 remains installed after installing 7x and cannot be removed without breaking system
- Always launch powershell via Windows Terminal on start menu - if you launch the old powershell icon you will get powershell 5 no matter what you do
/bin/bash^M: bad interpreter
means something has randomly converted your files from git to windows line endings. Probably git
, see setup instructions above
The command docker' could not be found in this WSL 2 distro
.- Restart Docker Desktop
- purge docker data:
- WSL filesystem mount is so slow! microsoft/WSL#9430