"WSL Debian 설치+나만의 설정"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-<source +<syntaxhighlight , -</source> +</syntaxhighlight>))
4번째 줄: 4번째 줄:
==설치==
==설치==
{{소스헤더|CMD 창}}
{{소스헤더|CMD 창}}
<source lang='doscon'>
<syntaxhighlight lang='doscon'>
C:\Users\jmnote>wsl -l -v
C:\Users\jmnote>wsl -l -v
Linux용 Windows 하위 시스템에 배포가 설치되어 있지 않습니다.
Linux용 Windows 하위 시스템에 배포가 설치되어 있지 않습니다.
아래의 Microsoft Store에서 배포를 설치할 수 있습니다.
아래의 Microsoft Store에서 배포를 설치할 수 있습니다.
https://aka.ms/wslstore
https://aka.ms/wslstore
</source>
</syntaxhighlight>
* https://aka.ms/wslstore 접속하여 Debian 설치, 시작
* https://aka.ms/wslstore 접속하여 Debian 설치, 시작


15번째 줄: 15번째 줄:


{{소스헤더|Debian 창}}
{{소스헤더|Debian 창}}
<source lang='console'>
<syntaxhighlight lang='console'>
Installing, this may take a few minutes...
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
Please create a default UNIX user account. The username does not need to match your Windows username.
25번째 줄: 25번째 줄:
Installation successful!
Installation successful!
testuser1@DESKTOP-VKP61Q8:~$
testuser1@DESKTOP-VKP61Q8:~$
</source>
</syntaxhighlight>


{{소스헤더|CMD 창}}
{{소스헤더|CMD 창}}
<source lang='doscon'>
<syntaxhighlight lang='doscon'>
C:\Users\jmnote>wsl -l -v
C:\Users\jmnote>wsl -l -v
   NAME      STATE          VERSION
   NAME      STATE          VERSION
* Debian    Running        2
* Debian    Running        2
</source>
</syntaxhighlight>


==sudoers 설정==
==sudoers 설정==
{{참고|리눅스 sudo 패스워드 없이 사용}}
{{참고|리눅스 sudo 패스워드 없이 사용}}
<source lang='console'>
<syntaxhighlight lang='console'>
testuser1@DESKTOP-VKP61Q8:~$ sudo -i
testuser1@DESKTOP-VKP61Q8:~$ sudo -i


48번째 줄: 48번째 줄:
[sudo] password for testuser1: P@ssw0rd
[sudo] password for testuser1: P@ssw0rd
root@DESKTOP-VKP61Q8:~#
root@DESKTOP-VKP61Q8:~#
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
root@DESKTOP-VKP61Q8:~# echo 'testuser1 ALL=NOPASSWD: ALL' >> /etc/sudoers
root@DESKTOP-VKP61Q8:~# echo 'testuser1 ALL=NOPASSWD: ALL' >> /etc/sudoers
root@DESKTOP-VKP61Q8:~# exit
root@DESKTOP-VKP61Q8:~# exit
55번째 줄: 55번째 줄:
testuser1@DESKTOP-VKP61Q8:~$ sudo -i
testuser1@DESKTOP-VKP61Q8:~$ sudo -i
root@DESKTOP-VKP61Q8:~#
root@DESKTOP-VKP61Q8:~#
</source>
</syntaxhighlight>


==SSH 서버 설정==
==SSH 서버 설정==
<source lang='console'>
<syntaxhighlight lang='console'>
root@DESKTOP-VKP61Q8:~# apt update
root@DESKTOP-VKP61Q8:~# apt update
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
66번째 줄: 66번째 줄:
Reading state information... Done
Reading state information... Done
31 packages can be upgraded. Run 'apt list --upgradable' to see them.
31 packages can be upgraded. Run 'apt list --upgradable' to see them.
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
root@DESKTOP-VKP61Q8:~# apt install -y openssh-server
root@DESKTOP-VKP61Q8:~# apt install -y openssh-server
Reading package lists... Done
Reading package lists... Done
78번째 줄: 78번째 줄:
Processing triggers for libc-bin (2.28-10) ...
Processing triggers for libc-bin (2.28-10) ...
Processing triggers for systemd (241-7~deb10u4) ...
Processing triggers for systemd (241-7~deb10u4) ...
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
root@DESKTOP-VKP61Q8:~# /etc/init.d/ssh start
root@DESKTOP-VKP61Q8:~# /etc/init.d/ssh start
[ ok ] Starting OpenBSD Secure Shell server: sshd.
[ ok ] Starting OpenBSD Secure Shell server: sshd.
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
root@DESKTOP-VKP61Q8:~# ss -tnlp
root@DESKTOP-VKP61Q8:~# ss -tnlp
State      Recv-Q    Send-Q        Local Address:Port        Peer Address:Port
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                  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))
LISTEN    0          128                    [::]:22                  [::]:*        users:(("sshd",pid=1085,fd=4))
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
root@DESKTOP-VKP61Q8:~# STARTUP_DIR=$(ls -d /mnt/c/Users/*/AppData/Roaming/Microsoft/Windows/Start\ Menu/Programs/Startup)
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:~# echo 'wsl sudo /etc/init.d/ssh start' > "$STARTUP_DIR"/startup_ssh.bat
root@DESKTOP-VKP61Q8:~# grep ssh "$STARTUP_DIR"/*
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
/mnt/c/Users/jmnote/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/startup_ssh.bat:wsl /etc/init.d/ssh start
</source>
</syntaxhighlight>


==주요 유틸 설치==
==주요 유틸 설치==
<source lang='console'>
<syntaxhighlight lang='console'>
root@DESKTOP-VKP61Q8:~# apt install -y curl
root@DESKTOP-VKP61Q8:~# apt install -y curl
... (생략)
... (생략)
104번째 줄: 104번째 줄:
Running hooks in /etc/ca-certificates/update.d...
Running hooks in /etc/ca-certificates/update.d...
done.
done.
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2021년 9월 24일 (금) 23:38 판

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 }}