How to install Fedora on wsl2
How to install multiple instances of Fedora on wsl2 and configure Fedora
There are several packages available in the Microsoft Store for installing Fedora on WSL 2, but none of them are official distributions (as of November 2023). Additionally, you cannot install multiple instances of Linux on WSL using Microsoft Store packages.
Part one: Installing latest release of Fedora on wsl2
Alternatively, you can install (import) new distributions on WSL 2 from your local files. First, you need to download a build from the Fedora Project’s GitHub page. The latest version as of today is version 38.
- Open (click on) this link to go to Fedoraproject’g Github
- open the matching Fedora build for your system. I have a 64bit pc so I downloaded “fedora-38-x86_64.tar.xz”. Download Fedora38 x86_64
Update December 21, 2023:
Now Fedora 39 is released, you can download fedora 39 and the proceed the installation: Download Fedora39 x86_64
-
You need 7zip to extract the downloaded “tar.xz” file using “7zip” -> “Extract Here”. You end up with a tar file.
-
Right click anywhere on empty place inside explorer and choose “Open in Terminal”
- Then in terminal, we need can use “wsl —import” command which takes 3 arguments:
- distribution-name: You can name it what ever you want
- destination-path: You can install it any where in your system but you need to have permissions to modify files in that folder. Windows installs linux distributions in a folder named “wsl”.
- installation file path. In this case we have opened terminal from same folder so you type only the file name.
wsl --import <distribution-name> <destination-path> <file-name>
In this case it becomes:
wsl --import fedora38 c:\wsl fedora-38-x86_64.tar
Installing multiple instances of linux (fedora) on wsl2
If you plan to install multiple instances of the same Linux distribution, you need to create a folder for each instance. You cannot install two instances of Fedora 38 in the same folder, even if you give them different names. Copy these commands to first create a folder and then import your Fedora distribution.
Don’t forget to change the distro-name (fedora38) and destination folder (distros) for each instance.
mkdir -p c:\wsl\distros
wsl --import fedora38 c:\wsl\distros fedora-38-x86_64.tar
Now you can start your new Fedora linux by typing:
wsl -d fedora38
Congrats! Now you have successfully installed fedora on your wsl2. Now you need to configure Fedora because the build is a bare bone linux.