How to install Fedora on WSL for Windows 10 and Windows 11
If you like your Linux a little more Red Hat flavored, here's how to get started.
The Windows Subsystem for Linux (WSL) is an incredible tool that puts real Linux on top of the Windows 10 or 11 PC you already know and love. Setting up is simple, but out of the gate the default Linux distribution (unless you specify otherwise) will be Ubuntu.
But the choice does not end there. While there are a number of distributions available through the Microsoft Store, you're not even limited to just those. In the case of Fedora, it sort of is.
Fedora has been gaining a lot of traction in the Linux space in recent times. This upstream distribution from the same company that also pushes out CentOS and Red Hat Enterprise Linux (RHEL) is fast and easy to use. If you'd like to get some Fedora spun up on your WSL setup, here's everything you need to know.
How to install Fedora on WSL - the easy way
This guide assumes you already have WSL2 up and running on your PC, so I'm going to skip that part. If you don't yet have it setup, I've written a complete guide on how to setup and install WSL2 on Windows 10 and 11 you should check out first.
Assuming all that there's a really easy way to use Fedora on WSL and that's by installing Fedora Remix by Whitewater Foundry. This isn't an official release by the Fedora Project, instead it has been customized and packaged for distribution by a third-party with built-in optimizations for WSL.
In the Microsoft Store it costs $10, but you can grab it directly from GitHub or through the Windows Package Manager for free. If you want to help support the project, by all means buy the paid version as that's what it's for.
Installing Fedora Remix is no different to installing Ubuntu or Debian from the Microsoft Store. Once the package is installed you just need to launch it, enter a username and password and you're all set. Fedora Remix includes such customizations as the third-party WSL Utilities out of the box, as well as some essential tweaks to the DNF configuration to make it a little snappier. At the time of writing, Fedora Remix is on the latest version 38.
Get the Windows Central Newsletter
All the latest news, reviews, and guides for Windows and Xbox diehards.
There's also an alternative available through the Microsoft Store simply called Fedora WSL. This is built from a Fedora rootfs with some pre-installed packages and in many ways is similar to the likes of Linux Mint and Manjaro which have been built for WSL by the community. Both of these apps are open source and on GitHub, so which you go for is entirely up to you. In both cases you simply have to download, install, enter minimal setup information and you'll have a working version of Fedora on your machine.
How to install Fedora and set everything up yourself from scratch
If either of those two pre-packaged methods are too easy for you, or you want to essentially start from nothing and build it yourself from scratch, you can also do that. This works in a similar way to how Fedora WSL mentioned above was created, only you're doing it all yourself.
The process involves downloading a build of Fedora, extracting the file system, importing that into WSL and then adding everything you want on top. For this you will also need to be able to extract from a .tar.xz file so you'll need WinRAR handy.
1. Go to this URL.
2. Download the most current build, at the time of writing it's Fedora 38.
3. Extract the contents of the .tar.xz file using WinRAR.
4. Locate the layer.tar file within.
5. Copy it to an easy location to navigate to (you'll need this in the terminal so make it as easy as you can) and rename it to something memorable. In this case, I called it fedora38.tar and placed it on the C:\ drive for easy access.
6. Open Windows Terminal into PowerShell.
The next stage involves importing the Fedora filesystem into WSL. We couldn't use the entire package downloaded from Fedora, but WSL does recognize importing .tar files. So, to import the Fedora filesystem into your WSL setup you'll need the following command structure:
wsl --import (distribution) (install location) (file location and filename)
So, based on the example given in the steps above, the command looks like this on my PC:
wsl --import fedora38 c:\wsl c:\fedora38.tar
It'll take a moment to complete, but once done you can launch into it with the wsl -d command followed by whatever you named it, or from the dropdown in Windows Terminal next time you launch it.
Unlike Fedora Remix, this will be a completely basic, barebones setup. You'll need to add everything including even the passwd feature to be able to add and change user passwords. It's definitely only recommended for more advanced users who know their way around. For most users I'd still recommend Fedora Remix.
Adding RPMFusion to Fedora on WSL
Like on desktop Fedora, one of the first things to do after you're set up is to add the RPMFusion repos. For reasons there are packages that Fedora cannot distribute built into the operating system, and these mostly live inside RPMFusion.
Adding it to Fedora on WSL, however, is just as easy as adding it to a full desktop install. Simply open up a terminal and enter this command:
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
Do a quick sudo dnf update to then pull in all the latest, and you're set. RPMFusion will now be called when using dnf in Fedora. For more on what RPMFusion is check out the website.
What you now have is a fully functioning instance of Fedora in WSL on your Windows machine to integrate into your workflows however you need it!
Richard Devine is a Managing Editor at Windows Central with over a decade of experience. A former Project Manager and long-term tech addict, he joined Mobile Nations in 2011 and has been found on Android Central and iMore as well as Windows Central. Currently, you'll find him steering the site's coverage of all manner of PC hardware and reviews. Find him on Mastodon at mstdn.social/@richdevine
-
coffee-turtle Any examples/projects on what people have used this ability to accomplish?Reply
Thanks!