wsl: add jupyterlab
This commit is contained in:
@@ -110,6 +110,8 @@ docker run --gpus all debian nvidia-smi # test
|
|||||||
|
|
||||||
# [추가] WSL에 Python & Jupyter Lab 설치
|
# [추가] WSL에 Python & Jupyter Lab 설치
|
||||||
|
|
||||||
|
## 8. debian에 python 설치
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo apt-get update && sudo apt-get install -y python3-venv
|
sudo apt-get update && sudo apt-get install -y python3-venv
|
||||||
cd ~
|
cd ~
|
||||||
@@ -129,3 +131,43 @@ pip install jupyter lab
|
|||||||
|
|
||||||
jupyter lab --IdentityProvider.token="" # 암호 없이 localhost:8888 로그인 가능
|
jupyter lab --IdentityProvider.token="" # 암호 없이 localhost:8888 로그인 가능
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 9. Windows 재부팅시 Jupyter Lab 자동시작
|
||||||
|
|
||||||
|
먼저 ssh를 통해 비밀번호 없이 자신에게 접속할수 있도록 세팅해야 한다.
|
||||||
|
```sh
|
||||||
|
sudo apt-get update && sudo apt-get install -y openssh-server
|
||||||
|
sudo systemctl start ssh # ssh-server 시작
|
||||||
|
ssh-keygen # [Enter] 계속 눌러 ~/.ssh 폴더에 비밀키 생성
|
||||||
|
|
||||||
|
ssh localhost # 자기자신으로 접속된다.
|
||||||
|
|
||||||
|
ssh-copy-id localhost
|
||||||
|
ssh localhost # 자기자신으로 접속되는데 비밀번호가 필요하지 않게 된다.
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd ~
|
||||||
|
mkdir -p .jupyter # 없으면 폴더를 만든다.
|
||||||
|
cd .jupyter
|
||||||
|
|
||||||
|
cat <<"EOF" > docker-compose.yml
|
||||||
|
services:
|
||||||
|
jupyter:
|
||||||
|
image: linuxserver/openssh-server
|
||||||
|
container_name: jupyter
|
||||||
|
restart: unless-stopped
|
||||||
|
stop_grace_period: 0s
|
||||||
|
network_mode: host
|
||||||
|
volumes:
|
||||||
|
- $HOME/.ssh:/root/.ssh
|
||||||
|
entrypoint: ssh w@localhost '~/.venv/bin/jupyter lab --IdentityProvider.token=""'
|
||||||
|
EOF
|
||||||
|
docker compose up -d # Jupyter 서버 시작
|
||||||
|
|
||||||
|
docker compose logs -f # 서버 상태 보기 & Ctrl+C로 나오기
|
||||||
|
|
||||||
|
cd ~/.jupyter && docker compose down # 서버 종료
|
||||||
|
```
|
||||||
|
|
||||||
|
- 만약 `6. WSL background 실행`과 `9. Windows 재부팅시 Jupyter Lab 자동시작` 모두 정확히 설정되었다면 윈도우를 재부팅하고 바로 localhost:8888에 접속할 수 있게 된다.
|
||||||
|
|||||||
Reference in New Issue
Block a user