Skip to content

Instantly share code, notes, and snippets.

@wohugb
Last active September 26, 2023 00:38
Show Gist options
  • Save wohugb/c8a12fb30f688cfc29479b5527cc2938 to your computer and use it in GitHub Desktop.
Save wohugb/c8a12fb30f688cfc29479b5527cc2938 to your computer and use it in GitHub Desktop.
如何将wsl安装到E:盘并使用代理
# 1. 安装ubuntu
wsl --install
# 2. 关闭ubuntu,否则迁移失败
wsl -l -v
* Ubuntu Running 2
wsl --terminate ubuntu
# 或者
wsl --shutdown
wsl -l -v
* Ubuntu Stopped 2
# 3. 移动ubuntu: 设置-应用-搜索-ubuntu-点选-移动-E:盘
# 4. 启动ubuntu
wsl
# 5. 设置代理
vi .proxy
# 添加内容同.proxy文件
# !使用的是clash, 注意打开 Allow LAN选项
# !需要关闭防火墙,否则链接被拒绝
source .proxy
# 6. 测试代理
curl www.google.com
#!/bin/bash
hostip=$(cat /etc/resolv.conf |grep -oP '(?<=nameserver\ ).*')
export https_proxy="http://${hostip}:7890"
export http_proxy="http://${hostip}:7890"
export all_proxy="socks5://${hostip}:7890"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment