Install latest NVIDIA Driver for GPU Support.
Do not install any Linux display driver in WSL.
In Command Prompt as Administrator
C:\> cd \Windows\System32\lxss\lib
C:\> del libcuda.so libcuda.so.1
C:\> mklink libcuda.so libcuda.so.1.1
C:\> mklink libcuda.so.1 libcuda.so.1.1
PS C:\Users\nbitra> nvidia-smi
Ensure you have the latest WSL kernel.
PS C:\Users\user1> wsl --update
PS C:\Users\user1> wsl --version
Display a list of available distributions
PS C:\Users\user1> wsl --list --online
The following is a list of valid distributions that can be installed.
Install using 'wsl.exe --install <Distro>'.
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS
Ubuntu-24.04 Ubuntu 24.04 LTS
OracleLinux_7_9 Oracle Linux 7.9
OracleLinux_8_7 Oracle Linux 8.7
OracleLinux_9_1 Oracle Linux 9.1
openSUSE-Leap-15.6 openSUSE Leap 15.6
SUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5
SUSE-Linux-Enterprise-15-SP6 SUSE Linux Enterprise 15 SP6
openSUSE-Tumbleweed openSUSE Tumbleweed
Increase swap space. Remove .txt extension.
C:\Users\user1> type .wslconfig
[wsl2]
memory=4GB
swap=16GB
Install a Windows Subsystem for Linux distribution.
PS C:\Users\user1> wsl --install -d OracleLinux_9_1
Installing: Oracle Linux 9.1
Oracle Linux 9.1 has been installed.
Launching Oracle Linux 9.1...
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: user1
Changing password for user user1.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
Installation successful!
Update the packages and kernel
$ cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="9.1"
Update packages
$ sudo dnf update -y
To disable Security-Enhanced Linux (SELinux)
Change the line SELINUX=enforcing to SELINUX=disabled in /etc/selinux/config
$ sestatus
SELinux status: disabled
Enable systemd in /etc/wsl.conf
[boot]
systemd=true
$ free -m
total used free shared buff/cache available
Mem: 3920 456 3500 2 156 3464
Swap: 16384 0 16384
Show the status of Windows Subsystem for Linux
PS C:\> wsl --status
Default Distribution: OracleLinux_9_1
Default Version: 2
PS C:\> wsl -l -v
NAME STATE VERSION
* OracleLinux_9_1 Running 2
Set the distribution as the default
PS C:\> wsl -s OracleLinux_9_1
Terminate the distribution
PS C:\Users\nbitra> wsl -t <distro>
Terminate the distribution and VM
PS C:\> wsl --shutdown -d OracleLinux_9_1
wsl --system -d OracleLinux_9_1wsl -l -v
NAME STATE VERSION
* OracleLinux_9_1 Stopped 2
Launch the distribution
PS C:\> OracleLinux91
PS C:\Users\nbitra> wsl -l -v
NAME STATE VERSION
* OracleLinux_9_1 Running 2
Get WSL Linux host IP to login via SSH
PS C:\> wsl -- ip addr s eth0 | findstr -i inet
Connect Linux host via SSH
PS C:\> ssh Linux_User@Linux_IP
Uninstall the distribution and delete the root filesystem
PS C:\> wsl --unregister <distro>
Unregistering...
PS C:\> wsl -l -v
Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
No comments:
Post a Comment