코딩, 개발에 대한 기록 저장소

WSL 리눅스 설치 경로 변경 방법

WSL 설치 경로를 C 드라이브에서 D 드라이브로 이동하는 방법 설명

기본 설치 경로

C:\Users<유저명>\AppData\Local\Packages<리죽스이름>\localState 아래 ext4.vhdx 파일로 설치됨

export

# wsl --export <리눅스 이름> <파일 경로>
wsl --export Ubuntu-18.04 D:\ubuntu-18-04.tar

기존 버전 삭제

# wsl --unregister <리눅스 이름>
wsl --unregister Ubuntu-18.04

import

# wsl --import <설정해 줄 리눅스 이름> <설치경로> <추출한 파일 경로>
wsl --import Ubuntu-18.04 D:\wsl\ubuntu-18-04\ D:\ubuntu-18-04.tar

기본 사용자 설정

처음 실행하면 root 로 실행됨. wsl 안에서 wsl.conf 파일 생성후 아래 옵션 추가

$ touch /etc/wsl.conf
$ vi /etc/wsl.conf
[user]
default=<userid>

wsl 재시작