Last active
September 26, 2023 00:38
-
-
Save wohugb/c8a12fb30f688cfc29479b5527cc2938 to your computer and use it in GitHub Desktop.
如何将wsl安装到E:盘并使用代理
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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