WSL configuration ad usage
Advanced Oracle Linux 9 Configuration in WSL2
1. Windows Environment Preparation
Before installation, virtualization features must be activated in Windows (PowerShell as Administrator).
powershell
Disable-NetAdapterBinding -Name "*" -ComponentID ms_tcpip6
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestartAfter restarting the system, perform an update:
powershell
wsl --update --web-download
wsl --set-default-version 22. Global Engine Configuration (.wslconfig)
The .wslconfig file controls the parameters for all WSL2 machines. It should be created at: C:\Users\<your_username>\.wslconfig.
ini
[wsl2]
# Virtual disk size
defaultVhdSize = 40GB
# DNS Tunneling prevents network issues in different locations
dnsTunneling = true
# Mirrored networking mode (host IP inheritance)
networkingMode = mirrored
# Additional parameters for network stability
autoProxy = trueImportant notes regarding host networking:
By using networkingMode = mirrored, the Linux machine receives the same IP addresses as your Windows host.
- This means no port forwarding is required.
- Limitation: If you use multiple WSL distributions simultaneously, they cannot use the same ports (address conflict, just like within a single operating system).
3. Installation and Import of OL9
The Oracle Linux 9 distribution is installed by importing a previously prepared rootfs archive.
powershell
wsl --import OL9 C:\wsl2\ol9 C:\path\to\file\oraclelinux-9-amd64-rootfs.tar --version 24. Machine Management
A collection of the most common commands for environment handling:
- Starting the machine:
powershell
wsl -d OL9- Logging in as root:
powershell
wsl -d OL9 -u root- Shutting down the machine (required to reload .wslconfig):
powershell
wsl --shutdown- Checking status and version:
powershell
wsl --list --verbose- Removing the distribution (clears registry, but not files):
powershell
wsl --unregister OL9- Cleaning the folder (PowerShell):
powershell
Remove-Item -Path C:\wsl2\ol9 -Recurse -Force
Last updated on