-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfedora-wsl2-setup
73 lines (54 loc) · 2.37 KB
/
fedora-wsl2-setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Based on:
https://gist.github.com/kmatt/71603170556ef8ffd14984af77ff10c5
https://fedoramagazine.org/wsl-fedora-33/
# prompt ">" indicates Powershell commands
# https://docs.microsoft.com/en-us/windows/wsl/install-win10
> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# Update WSL
> wsl --update
# or install https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
# Set WSL to WSL2
> wsl --set-default-version 2
# Use container image as rootfs from https://fedoraproject.org/cloud/download
# Extract the layer.tar file and rename to fedora-$version.tar
# Create directory for rootfs
> mkdir $HOME\wsl2\Fedora-$version
# Import the rootfs
# example: wsl.exe --import Fedora $HOMSE\wsl2\fedora-39 $HOME\Downloads\fedora-39.tar
> wsl.exe --import $DISTRONAME $STORAGEPATH fedora-$VERSION.tar
> wsl -d $DISTRONAME
# Enable man pages
# Edit dnf.conf and remove or comment out the line "tsflags=nodocs"
$ dnf install -y man man-pages
$ for pkg in $(dnf repoquery --installed --qf "%{name}"); do sudo dnf reinstall -qy $pkg; done
# Install some necessary utilities
$ dnf install wget curl sudo ncurses dnf-plugins-core dnf-utils passwd findutils cracklib cracklib-dicts util-linux iproute
$ useradd -G wheel $USER
$ passwd $USER
$ echo -e "[user]\ndefault=$USER" > /etc/wsl.conf
# Update Fedora
$ dnf update
# Optional: Enable systemd
$ dnf install systemd
$ echo -e "[boot]\nsystemd=true" >> /etc/wsl.conf
# optional wslu utilities
$ dnf copr enable wslutilities/wslu
$ dnf install -y wslu
# Optional - Fix pam_sss.so messaging in journalctl
# (systemd)[210]: PAM unable to dlopen(/usr/lib64/security/pam_sss.so): /usr/lib64/security/pam_sss.so: cannot open shared object file: No such file or directory
# (systemd)[210]: PAM adding faulty module: /usr/lib64/security/pam_sss.so
$ authselect select minimal
# Optional - OS name
# Edit /etc/os-release to remove unwanted naming.
# Optional - Fonts
# Edit /etc/fonts/local.conf and add the following:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>/mnt/c/Windows/Fonts</dir>
<dir>~/winhome/AppData/Local/Microsoft/Windows/Fonts</dir>
</fontconfig>
> wsl -t $DISTRONAME
# Reference - /etc/wsl.conf
https://learn.microsoft.com/en-us/windows/wsl/wsl-config