Those are my personal settings for Windows' environments. Here I have a bit of PowerShell files, including common application installation through Chocolatey, and developer-minded Windows configuration defaults.
Usually as Linux host (with WSL), on Windows I just keep initial configs, that includes Git (Bash), Java e some IDE's.
- Custom Windows Start Menu
- Scoop and Chocolatey (package manager)
- Packages list (wsl, dev, utils) installed via chocolatey
- Windows Terminal (custom settings.json) + Starship + NerdFonts
- Git - SSH keys and Bash aliases (on Windows)
- Code (and Java/JavaScript extensions)
- WSL setup and ArchWSL (distro)
PowerShell scripts are easy to use but there are a couple of things to be aware of, especially when it is the first time you use such scripts.
The PowerShell Execution Policy determines whether PowerShell scripts are allowed to run. By default, the Execution Policy is set to Restricted.
*To change the execution policy (on powershell terminal):
- 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope currentUser' before executing your scripts (*Once you close, it will default back to the original execution policy)
- 'powershell -executionpolicy bypass -File .\install.ps1' using execution policy as parameter to run all scripts
To execute any command to change execution policy, you must have administrator permission, open PowerShell command prompt with Run as administrator
See Microsoft's Docs About Execution Policies for detailed information.
To export, use export-config.ps1 and create a StartMenuLayout.xml.
powershell -executionpolicy bypass -File .\ps1\export-start-layout-config.ps1
To import, open gpedit.msc (Menu > Run) and set a path on User Configuration > Administrative Template > Start Menu and Taskbar
*Need active Group Policy Editor. On Windows Home, this funcionability has inactive by default.
- Install Scoop (Running the scoop installer as administrator is disabled by default, run powershell with user privileges)
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
Read Scoop Wiki
-
Close PowerShell and reopen as Administrator
-
Install Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
NOTE: Windows 11 comes with WinGet by default which makes it officially Microsoft's open source package manager going forward. Right now using Chocolatey is better as it has more packages and is just easier to use. Scoop is especially focused on the handling of development environment building software such as programmers. Also, WinGet is not a package manager in the traditional sense as it only installs software in the formats - MSI, MSIX and some EXE.
- Install git and update $PATH
choco install git -y
$PathTemp = [Environment]::GetEnvironmentVariable('Path', 'User') + ';'
$PathTemp += 'C:\Program Files\Git\bin'
[Environment]::SetEnvironmentVariable('Path', $PathTemp, 'User')
- Ready to use git clone!
cd ~
git clone https://github.com/vanbrandaos/dotfiles-windows.git
- Install packages:
powershell -executionpolicy bypass -File .\ps1\install-chocolatey-packages.ps1
Use choco like pacman/apt get using these commands!
Yes! They have a GUI and you can install Chocolatey GUI via Chocolatey itself by executing:
choco install ChocolateyGUI
- If you didn't install it, install Windows Terminal (option 3) or skip
powershell -executionpolicy bypass -File .\ps1\install-chocolatey-packages.ps1
- Import settings.json (themes, shortcuts profiles, etc), starship and install nerd-fonts
powershell -executionpolicy bypass -File .\ps1\setup-windows-terminal.ps1
*Note: The custom settings bring up profiles that may not exist, such as WSL Arch (see below). You may need to change Terminal Profiles later. * Note: To install only Windows Terminal, run choco install microsoft-windows-terminal on PowerShell
Settings on/for Windows. Skip if you don't want keep your ssh key here, neither aliases for Bash and simulations for ls command.
- Create a new SSH key and symbolic links
powershell -executionpolicy bypass -File .\ps1\create-and-configure-ssh.ps1
OR
- Import your SSH (and symbolic links): Needed paste your public and private key to /git.
powershell -executionpolicy bypass -File .\ps1\import-and-configure-ssh.ps1
- Import .bash files (Bash with Windows Terminal)
powershell -executionpolicy bypass -File .\ps1\setup-bash.ps1
-
Replace 'ls' command (LSDeluxe):
3.1
First, the best way to install lsd was using 'scoop install lsd', but at moment (April 2022) scoop install 0.21.0 and Git bash cant handle the 256 color scheme thats introduced in lsd version 0.21. We need download and install lsd 0.20, extract and update $PATH with new lsd path (suggestion: ~/lsd). Open ~/.bashrc and update ls alias (lsd -la). *Bug on 0.21.3.2. Yes, i can do it:
powershell -executionpolicy bypass -File .\ps1\install-lsd.ps1
*Need some Nerd font. The 'Fantasque Sans Mono' font was installed (step 2 - Windows Terminal). Skip if you've already done this or download and install your favorite.
EXA is coming!
Very soon now. It is looking highly likely that the current version of exa (v0.10.0) will be the last without Windows support.
- Install extensions
powershell -executionpolicy bypass -File .\ps1\install-extensions.ps1
powershell -executionpolicy bypass -File .\ps1\install-java-extensions.ps1
- Copy .wslconfig file
Copy-Item "C:\Users\$env:UserName\dotfiles-windows\wsl\.wslconfig" -Destination "C:\Users\$env:UserName\"
Advanced settings configuration in WSL
- Install WSL:
-
Option 1: You must be running Windows 10 version 2004 and higher (Build 19041 and higher) or Windows
wsl --install
This option install Ubuntu. You can use 'wsl --install -d ' to set another distro.
-
Option 2: If you just prefer a clean install (also for older versions of WSL)
- Enable WSL
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
- Enable Virtual Machine
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
- Restart Windows
- Download and install the linux kernel
- Set WSL2 as default version
wsl --set-default-version 2
- Enable WSL
Warnings:
-
IP address on WSL2 machine cannot be made static (If this is me being an idiot, I'm not the only one):
-
Custom domain:
access the WSL2 VM from the Windows host, see update-host.sh (this shell belongs a .dotfiles for linux). This script, when called, updates your Windows hosts file with the WSL2 VM's IP address. Please change hostname.
cd scripts/wsl ./update-hosts.sh
If you are on W11, add this shell in the startup operations and avoid calling it every time when booting.
Find another solutions, like Go-WSL2-Host.
-
-
Launch GUI applications: For W10, try VcXsrv Windows X Server.
*If you prefer, search in Microsoft Store for other distros
- Download and install from github (or use install-arch.ps1)
powershell -executionpolicy bypass -File .\ps1\install-arch.ps1
- Reset Terminal, go to Arch folder (C:/wsl/Arch) and Setup ArchWSL for user and keyrings
- See Arch .dotfiles (only Arch distros)