Install Scoop a command-line installer for Windows
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
iex "& {$(irm get.scoop.sh)} -ScoopDir ${Env:USERPROFILE}\Scoop"
scoop install git
scoop bucket add extras
scoop install delta exiftool
Windows Package Manager and PowerShell
winget upgrade --all --silent --include-unknown
winget install Microsoft.PowerShell
winget install Microsoft.PowerToys
Font settings
Monaspace, Maple mono, Nerd fonts
scoop bucket add nerd-fonts
scoop install --global Monaspace JetBrains-Mono Maple-Mono Maple-Mono-NF Meslo-NF-Mono
Customize Powershell
Install-Module Terminal-Icons
winget install JanDeDobbeleer.OhMyPosh
Update Powershell profile setup.
winget install Microsoft.VisualStudioCode
code $PROFILE
Add Microsoft.PowerShell_profile.ps1 content and save the file.
Update Windows Terminal settings and set it as the default profile. Disable the logo on your PowerShell profile by adding -NoLogo
after the command and save the changes, like \pwsh.exe -NoLogo
- go to Settings/Defaults/Font face
and set Maple Mono SC NF
.
Install Visual Studio Code and Docker Desktop
winget install Docker.DockerDesktop
winget install Microsoft.VisualStudioCode
# WSL already installed
sudo apt update --yes && sudo apt upgrade --yes
mkdir ~/Downloads && cd ~/Downloads
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh ./get-docker.sh
sudo usermod -aG docker $USER
rm ~/Downloads/get-docker.sh
# If you encounter issues with Docker setup, consider deleting the ~/.docker folder both on the host and within WSL
Open Windows Terminal with Administrator permissions
Setup the new user. These commands are running in Powershell, not in WSL.
# Set up Ubuntu within WSL or choose a particular release, such as Ubuntu-22.04
wsl --install --distribution Ubuntu
Restart-Computer
# To rerun the previous command, use the up arrow key in the terminal, and WSL will update the kernel
wsl --install --distribution Ubuntu
wsl --update
wsl --user root apt update --yes
wsl --user root apt upgrade --yes
# Check system info
wsl lsb_release --all
# Set default distribution
wsl --list
wsl --set-default Ubuntu
# Prepare WSL image upgrade - cat /etc/os-release
sudo apt install update-manager-core
# Upgrade WSL image - use "-d" flag if necessary
sudo do-release-upgrade
sudo apt update --yes && sudo apt upgrade --yes
sudo apt install --yes zsh && sudo apt autoremove --yes
Tip
Add WSL config on the host
Check wslconfig. Restart WSL and Docker.
wsl --shutdown
code --install-extension ms-vscode-remote.remote-containers
code --install-extension ms-vscode-remote.remote-wsl
Note
You don't need to setup Git on host but recommended to set email and name globally.
Use Windows Terminal or VS Code, or use WSL Bash.
# On WSL Ubuntu
delta_version=0.16.5
cd Downloads
curl -sLO "https://github.com/dandavison/delta/releases/download/${delta_version}/git-delta_${delta_version}_amd64.deb"
sudo dpkg --install git-delta_${delta_version}_amd64.deb
sudo apt install --yes exiftool
rm ~/Downloads/git-delta_${delta_version}_amd64.deb
# Arch
# sudo pacman -S git-delta perl-image-exiftool
Advanced Git setup
Please check git_config file below before run following script!
bash -c "$(curl -sSL https://gist.githubusercontent.com/nandordudas/a80971a3cf4a4563a26bc9aa3cfc8c00/raw/git_config)"
Folder specific Git configuration
git config --global --edit
[includeIf "gitdir:~/Code/Github/"]
path = ~/Code/Github/.gitconfig
Add refspec
The +refs/merge-requests/*:refs/remotes/origin/merge-requests/*
refspec tells
Git to fetch all merge requests from the remote repository. The *
wildcard
matches all merge requests, and the :refs/remotes/origin/merge-requests/*
part tells Git to store the fetched merge requests in the
refs/remotes/origin/merge-requests/*
namespace.
git config --add remote.origin.fetch "+refs/merge-requests/*:refs/remotes/origin/merge-requests/*"
The +refs/pull/*/head:refs/remotes/pull_requests/*
refspec tells Git to fetch
the heads of all pull requests from the remote repository. The
refs/pull/*/head
part matches the heads of all pull requests,
and the :refs/remotes/pull_requests/*
part tells Git to store the fetched
heads in the refs/remotes/pull_requests/*
namespace.
git config --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/pull_requests/*"
The +refs/pull-requests/*/from:refs/remotes/origin/pr/*
refspec tells Git to
fetch the from branches of all pull requests from the remote repository.
The refs/pull-requests/*/from part matches
the from branches of all pull
requests, and the :refs/remotes/origin/pr/*
part tells Git to store the
fetched branches in the refs/remotes/origin/pr/*
namespace.
git config --add remote.origin.fetch "+refs/pull-requests/*/from:refs/remotes/origin/pr/*"
Setup zsh
Oh-My-Zsh, Powerlevel 10k, Fast syntax highlight and Zsh completions
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
plugins_path="${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins"
git config --global url."https://github.com/".insteadOf gh:
git clone gh:z-shell/F-Sy-H "${plugins_path}/F-Sy-H"
git clone gh:zsh-users/zsh-autosuggestions "${plugins_path}/zsh-autosuggestions"
sed -ie "s/plugins=.*/plugins=(git F-Sy-H zsh-autosuggestions)/g" ~/.zshrc
source ~/.zshrc
GPG for Win, sharing GPG keys and about commit signature verification
Please check what sudo does before installing it, or simply use the terminal as an administrator and execute the command without it.
scoop install sudo
sudo scoop install gpg4win
# Restarting the computer is recommended, but even signing off is sufficient
Logoff
Log back into WSL. Enjoy.