Received new laptop that runs Windows 11 over the weekend.
Had spent some times on customize a few things:
- Install Google_Pinyin
- Setup the input method switching to (left) ctrl-shift notkey.
- Install WSL/WSL2
- Install Windows Terminal
- Install Multipass (VM orchestrator)
- Setup ssh-keygen
- Create sample multipass VM with cloud-init
- Install python3 (in Windows 11)
Between WSL and Multipass, I need to setup the routing in order for them to communicate.
PS> Set-NetIPInterface -ifAlias "vEthernet (WSL)" -Forwarding EnabledPS> Set-NetIPInterface -ifAlias "vEthernet (Default Switch)" -Forwarding Enabled
And to show the final routing table:
PS> Get-NetIPInterface | select ifIndex,InterfaceAlias,AddressFamily,ConnectionState,Forwarding | Sort-Object -Property IfIndex | Format-Table
One the routing is configured, then I proceed with ssh-keygen and setup the public key authentication between WSL and multipass.
~$ cd .ssh~/.ssh$ ssh-keygen -t ed25519 -C "xx@wsl2"~/.ssh$ ssh-keygen -l -f id_ed25519.pub~/.ssh$ ssh-copy-id -i id_ed25519.pub xx@remote_server
Next, I need to setup multipass VM with cloud-init.
Create a cloud-init.yaml file for multipass:
-------------------------------users:- default- name: xxgroups: sudoshell: /bin/bashsudo: ['ALL=(ALL) NOPASSWD:ALL']ssh_authorized_keys:- ssh-rsa <rsa keys in one line>package_update: truepackage_upgrade: truepackages:- nodejs- python3-------------------------------
PS> multipass multipass launch -c 2 -m 2G -d 20G -n ubuntu-vm --cloud-init cloud_init.yaml
Learnt some tricks in Windows command line. I install Python (with cmdline) and locate where is the python.exe.
PS> winget install python --source msstorePS> where python