wsl2折腾记录

相关issue

mirror镜像模式失效:https://github.com/microsoft/WSL/issues/10632
wsl2设置桥接网络或镜像网络,解决服务互通访问的问题 https://zhuanlan.zhihu.com/p/659074950
新版本下如何通过外部网络访问wsl https://zhuanlan.zhihu.com/p/672297125
wsl配置 https://learn.microsoft.com/zh-cn/windows/wsl/wsl-config#configuration-settings-for-wslconfig

清理遗留,清洁安装

卸载电脑上所有linux发行版后

wsl --uninstall
wsl --update

安装wsl内核

.wslconfig

[wsl2]
guiapplications=true
[experimental]
autoMemoryReclaim=gradual
sparseVhd=true
networkingMode=mirrored
dnsTunneling=true
autoProxy=true
hostAddressLoopback=true
firewall=false

wsl内走代理:

export http_proxy='http://localhost:7897'
export https_proxy='https://localhost:7897'

永久设置环境:https://unix.stackexchange.com/questions/117467/how-to-permanently-set-environmental-variables

在安装完镜像源得ca-certificate后,若想取消设置(不建议,优先走镜像,再走代理):

unset http_proxy; unset https_proxy;

安装debian

vi 使用指南:https://www.runoob.com/linux/linux-vim.html

设置vscode为sudoeditor

https://stackoverflow.com/questions/58980356/vscode-in-wsl-how-to-sudo-a-root-file-so-i-can-edit-it/77507776#77507776

镜像源

https://mirrors.tuna.tsinghua.edu.cn/help/debian/

安装docker

为什么不装docker for Windows,反而要在wsl内装docker:

  • 任何终端都无法连接docker for windows的容器内部,会报错(魔改环境转换)
  • docker for Windows 自带terminal太难用
  • docker for windows 需要登录

https://docs.docker.com/engine/install/debian/

sudo -i
service docker start

pull run

https://hub.docker.com/search?q=youtube

docker pull jeeaaasustest/youtube-dl

某些项目有无法解决的错误,得二次做image,这是项目内 Dockerfile:

FROM who/project
RUN mkdir -p /var/local/youtube-dl-server/

然后docker build -t mynewimage .

docker run -d --name=ytb -p 127.0.0.1:8181:8080 -e YDL_CONFIG_PATH=/var/local/youtube-dl-server/config.yml  my_ytb

结局

最后发现idM可以下载ytb,算了

posted @ 2024-04-03 08:52  Nolca  阅读(117)  评论(0编辑  收藏  举报