Running RHEL (Red Hat Enterprise Linux)/Fedora on WSL allows users to enjoy the flexibility of Linux within a Windows environment. Irrespective of who is accessing it, WSL enables them to run Fedora or RHEL natively without needing a virtual machine or dual boot setup. In this article, we will walk through the steps to enable to run RHEL/Fedora on Windows Subsystem for Linux(WSL)
How to run RHEL/ Fedora on Windows Subsystem for Linux (WSL)
Execute the steps below to run RHEL (Red Hat Enterprise Linux)/Fedora on Windows Subsystem for Linux (WSL).
- Enable WSL on Windows
- Install Fedora on WSL
- Install RHEL on WSL
Let’s get to know how to run RHEL /Fedora on WSL.
1] Enable WSL on Windows
Before installing Fedora or RHEL, the first step is to enable Windows Subsystem for Linux, which will allow Windows to run Linux distributions. To do the same, follow the steps mentioned below:
- Click Win + X, and click on Terminal (Admin) to open Powershell with administrative privileges.
- Run the following command to install WSL, enable it as well as the Virtual Machine Platform, and install the default Linux Distribution (usually Ubuntu).
wsl.exe --install
- To search for other available distributions and install them, run the following commands respectively:
wsl --list --online wsl --install -d DISTRO-NAME
Note: replace Distro Name with the desired distribution’s name.
- Once WSL is installed, run the following command to enable it:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
- Next, reboot the PC to apply the changes by running the following command:
Restart-Computer -Force
Once we have enabled WSL and rebooted the PC, the next step is to download and install the Fedora/ RHEL root filesystem.
2] Install Fedora on WSL
Since Fedora was not available on the distribution list, we are going to proceed and install the Fedora Linux installer or zip file, and then run it.
Users can download the installer file or run the following commands:
For Fedora 37
wget https://github.com/yosukes-dev/FedoraWSL/releases/download/37.20230124.0/Fedora37.zip
For Fedora 36
wget https://github.com/yosukes-dev/FedoraWSL/releases/download/36.20230124.0/Fedora36.zip
For Fedora 35
wget https://github.com/yosukes-dev/FedoraWSL/releases/download/35.20211113.0/Fedora35.zip
For Fedora 34
wget https://github.com/yosukes-dev/FedoraWSL/releases/download/34.20211113.0/Fedora34.zip
After the zip file is downloaded, the next step is to extract it. If the command doesn’t download the ZIP file, you can just copy and paste the URL into a browser and then start downloading.
Users will see two files: Fedore.exe and RootFS. To do so, right-click on the downloaded zip file and select Extract All. Choose a destination folder, provide a name to use for multiple Fedora instances, and click Extract to finish the process.
Run the Fedora.exe file to register the Fedora System in WSL.
Alternatively, to register it for WSL2, run the following command:
wsl --set-version RHWSL 2
To check if Fedora has been added successfully to WSL, run the following command:
wsl --list --all
To open the Fedora Shell in WSL, run the following command:
wsl --distribution <VM Name>
Note: VM Name will be replaced with the specified WSL distribution, e.g. Fedora37
Once inside Fedora, users can update packages, add new users as well and install additional software.
Read: How to run .sh or Shell Script file in Windows
3] Install RHEL on WSL
After installing and enabling WSL on Windows, here’s how to install and use RHEL on WSL.
Start by downloading the necessary release from Github, or run the following commands in the elevated Powershell based on your required version:
RHEL 9.1
wget https://github.com/yosukes-dev/RHWSL/releases/download/9.1.0-1750/RHWSL.zip
RHEL 9
wget https://github.com/yosukes-dev/RHWSL/releases/download/9.0.0-1468.1655190709/RHWSL.zip
RHEL 8.7
wget https://github.com/yosukes-dev/RHWSL/releases/download/8.7-1054/RHWSL.zip
Wait for it to download, extract it in the same way we did for the Fedora ZIP file, and then run the RHWSL.exe file to register RHEL on WSL. Run the command mentioned below to register for WSL2:
wsl --set-version RHWSL 2
To check if RHEL has been successfully installed and registered, run
wsl --list --all
Run the commands respectively to start RHEL, register it with Red Hat’s Subscription service, and attach it:
Start:
wsl --distribution RHWSL
Register:
subscription-manager register
Attach:
subscription-manager attach
Users can install the necessary package by running the following command:
dnf install <package-name>
Users can now run both Fedora and RHEL on WSL.
How do I run a specific distro in WSL2?
To run a specific distro in WSL2, users need to run the Powershell or command prompt with administrative rights and then check the available distros by running wsl --list --verbose
. Then it needs to be registered to WSL2 by running wsl --set-version <DistroName> 2
. Once done, run the following command to start it: wsl --distribution <DistroName>
.
What are the limitations of WSL?
WSL has several limitations, which include limited Linux kernel support and the restriction of certain system calls and modules. WSL1 has limited support for GUI applications, while hardware access is constrained. Moreover, performance can be lower than native Linux, and some applications, especially ones requiring systemd may not function properly.
Also Read: Import and export WSL distros on Windows.