Fedora
In this part, we’re setting up Fedora as our WSL distribution.
Info
Please also refer to Fedora’s official documentation
Install
Microsoft Store
If you can use the Microsoft Store, installing the Fedora distribution is as easy as installing the Fedora 42 app from the store.
Command line
wsl.exe --install FedoraLinux-42
Tar-based
Download the tarball from koji, then check your WSL version
wsl.exe --version
Info
The following part is mostly copy/pasted from the official documentation.
Version >= 2.4.4
- From the command line, install the tarball with
wsl --install --from-file .\path\to\Fedora.tar.xz
wsl.exe --install --from-file .\Fedora-WSL-Base-VERSION.x86_64.tar.xz
- Enter the environment by running
wsl.exe -d Fedora
- When prompted, provide a username. This will be the default user, and it will be added to the groups for
sudo
usage.
Version < 2.4.4
(These steps assume you are using PowerShell)
- Make a directory for the Fedora distribution with
mkdir $ENV:LOCALAPPDATA\WSL\Fedora
- Import the WSL tarball with
wsl.exe --import Fedora $ENV:LOCALAPPDATA\WSL\Fedora .\Fedora-WSL-Base-VERSION.x86_64.tar.xz
- Enter the environment with
wsl.exe -d Fedora -u root
- Manually run
/usr/libexec/wsl/oobe.sh
to create the default user exit
the environment logged in as root- Enter the environment as the newly created user with
wsl.exe -d Fedora -u username
Set a password
Make sure to set a password for the newly created user. This should be self-explanatory from a security standpoint.
From within WSL, do
sudo passwd username
Set it as the default
If you don’t have any other distro installed, you won’t have to do anything.
If you do, however, and want to use the Fedora distro by default, just run the following
wsl.exe --set-default FedoraLinux-42
Just Works™?
Note
This should only be neccessary if you’re behind a (corporate) proxy.
As I’m sitting behind a corporate http
proxy, I initially had no access to the internet.
This can be confirmed by running
curl https://fedoraproject.org
To make WSL proxy-aware, I needed to
- Add the exports to the
~/.bashrc
PROXY_URL="http://<hostname>:<port>"
export all_proxy="$PROXY_URL"
export http_proxy="$PROXY_URL"
export https_proxy="$PROXY_URL"
export ftp_proxy="$PROXY_URL"
export no_proxy="127.0.0.1,0.0.0.0,localhost"
export ALL_PROXY="$PROXY_URL"
export HTTP_PROXY="$PROXY_URL"
export HTTPS_PROXY="$PROXY_URL"
export FTP_PROXY="$PROXY_URL"
export NO_PROXY="$no_proxy"
- Source it
source ~/.bashrc
- Allow
sudo
to pass these environment variables through by setting theenv_keep
property in/etc/sudoers.d/proxy
Defaults env_keep += "all_proxy http_proxy https_proxy ftp_proxy no_proxy ALL_PROXY HTTP_PROXY HTTPS_PROXY FTP_PROXY NO_PROXY"
Rerunning the curl
-command should now produce a response, and your system should update just fine.