WSL Debian 설치+나만의 설정

(WSL2 Debian 설치+나만의 설정에서 넘어옴)

1 개요[ | ]

WSL2 Debian 설치+나만의 설정

2 설치[ | ]

CMD 창
C:\Users\jmnote>wsl -l -v
Linux용 Windows 하위 시스템에 배포가 설치되어 있지 않습니다.
아래의 Microsoft Store에서 배포를 설치할 수 있습니다.
https://aka.ms/wslstore

Wsl-media-store.png

Debian 창
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: testuser1
New password: P@ssw0rd
Retype new password: P@ssw0rd
passwd: password updated successfully
Installation successful!
testuser1@DESKTOP-VKP61Q8:~$
CMD 창
C:\Users\jmnote>wsl -l -v
  NAME      STATE           VERSION
* Debian    Running         2

3 sudoers 설정[ | ]

testuser1@DESKTOP-VKP61Q8:~$ sudo -i

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for testuser1: P@ssw0rd
root@DESKTOP-VKP61Q8:~#
root@DESKTOP-VKP61Q8:~# echo 'testuser1 ALL=NOPASSWD: ALL' >> /etc/sudoers
root@DESKTOP-VKP61Q8:~# exit
logout
testuser1@DESKTOP-VKP61Q8:~$ sudo -i
root@DESKTOP-VKP61Q8:~#

4 SSH 서버 설정[ | ]

root@DESKTOP-VKP61Q8:~# apt update
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [121 kB]
... (생략)
Building dependency tree
Reading state information... Done
31 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@DESKTOP-VKP61Q8:~# apt install -y openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
... (생략)
Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service.
Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /lib/systemd/system/ssh.service.
invoke-rc.d: could not determine current runlevel
Processing triggers for libc-bin (2.28-10) ...
Processing triggers for systemd (241-7~deb10u4) ...
root@DESKTOP-VKP61Q8:~# /etc/init.d/ssh start
[ ok ] Starting OpenBSD Secure Shell server: sshd.
root@DESKTOP-VKP61Q8:~# ss -tnlp
State      Recv-Q     Send-Q         Local Address:Port         Peer Address:Port
LISTEN     0          128                  0.0.0.0:22                0.0.0.0:*        users:(("sshd",pid=1085,fd=3))
LISTEN     0          128                     [::]:22                   [::]:*        users:(("sshd",pid=1085,fd=4))
root@DESKTOP-VKP61Q8:~# STARTUP_DIR=$(ls -d /mnt/c/Users/*/AppData/Roaming/Microsoft/Windows/Start\ Menu/Programs/Startup)
root@DESKTOP-VKP61Q8:~# echo 'wsl sudo /etc/init.d/ssh start' > "$STARTUP_DIR"/startup_ssh.bat
root@DESKTOP-VKP61Q8:~# grep ssh "$STARTUP_DIR"/*
/mnt/c/Users/jmnote/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/startup_ssh.bat:wsl /etc/init.d/ssh start

5 주요 유틸 설치[ | ]

root@DESKTOP-VKP61Q8:~# apt install -y curl
... (생략)
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.

6 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}