OS 요구사항 : Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11
참조링크 : https://learn.microsoft.com/en-us/windows/wsl/install#upgrade-version-from-wsl-1-to-wsl-2
1. Powershell 또는 command 창에서 하기 명령어를 통해 WSL sub system 설치.
# wsl –install
2. 리눅스 배포판을 선택하여 리눅스 가상시스템 설치
# wsl –list –online
다음은 설치할 수 있는 유효한 배포판 목록입니다.
‘wsl.exe –install <Distro>’를 사용하여 설치합니다.
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS
OracleLinux_7_9 Oracle Linux 7.9
OracleLinux_8_7 Oracle Linux 8.7
OracleLinux_9_1 Oracle Linux 9.1
openSUSE-Leap-15.5 openSUSE Leap 15.5
SUSE-Linux-Enterprise-Server-15-SP4 SUSE Linux Enterprise Server 15 SP4
SUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5
openSUSE-Tumbleweed openSUSE Tumbleweed
# wsl –install -d OracleLinux_7_9
-> 오라클리눅스 배포판을 선택하여 설치
설치 중: Oracle Linux 7.9
[ 0.0% ]
Oracle Linux 7.9이(가) 설치되었습니다.
Oracle Linux 7.9을(를) 시작하는 중…
Installing, this may take a few minutes…
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
Installation successful!
# wsl -l -v
-> 설치된 버전 확인
NAME STATE VERSION
* Ubuntu-22.04 Running 2
OracleLinux_7_9 Running 2
# wsl ; linux shell 진입 (default 배포판)
# wsl -s OracleLinux_7_9 ; default 배포판 변경.
# wsl -d Ubuntu-22.04 ; 지정된 배포판 shell 실행
# wsl –set-version Ubuntu-22.04 2 ; WSL 버전을 2로 변경, 비교표 참조.

참조 : https://learn.microsoft.com/ko-KR/windows/wsl/compare-versions
# wsl –unregister OracleLinux_7_9 ; 설치된 배포판 삭제
** WSL 사용시 systemctl 명령어가 “Host is down” 메세지와 작동되지 않을때.
$ systemctl
System has not been booted with systemd as init system (PID 1). Can’t operate.
Failed to connect to bus: Host is down
**하기 명령어를 입력.
$ sudo -b unshare --pid --fork --mount-proc /lib/systemd/systemd --system-unit=basic.target $ sudo -E nsenter --all -t $(pgrep -xo systemd) runuser -P -l $USER -c "exec $SHELL"