Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加自定义命令控制代理 #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions WSL2.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
## WSL2 设置固定IP

## WSL2 设置

### 镜像路径修改
说明:Docker Desktop也使用了WSL,而且有专门的名字, docker-desktop-data和docker-desktop
Expand All @@ -12,6 +11,32 @@ wsl --import docker-desktop-data F:\\docker\wsl\docker-desktop-data F:\\wsl\doc
wsl --import docker-desktop F:\\docker\wsl\docker-desktop F:\\wsl\docker-desktop.tar --version 2
```

#### 固定IP
+ [《WSL2固定IP解决方案》](https://www.loyating.com/articles/23)


#### 命令行代理设置
```shell
# 设置代理命令
export SOCKS5="socks5://192.168.1.12:7890"
alias httpProxy="export http_proxy=${SOCKS5};export https_proxy=${http_proxy}"
alias httpProxyOff="unset http_proxy;unset https_proxy"

alias gitProxy="git config --global http.proxy ${SOCKS5};git config --global https.proxy ${SOCKS5}"
alias gitProxyOff="git config --global --unset http.proxy;git config --global --unset https.proxy"
```

#### 修改WSL2的路径
```shell
wsl -l -v
wsl --export Ubuntu-22.04 F:\\wsl\Ubuntu-22.04.tar
wsl --unregister Ubuntu-22.04
wsl --import Ubuntu-22.04 F:\\docker\wsl\Ubuntu-22.04 F:\\wsl\Ubuntu-22.04.tar --version 2

Ubuntu2204 config --default-user username
```


### 参考资料
+ [《WSL2固定IP解决方案》](https://www.loyating.com/articles/23)
+ [《Windows10子系统WSL修改默认安装目录到其他盘》](https://blog.csdn.net/weixin_40837318/article/details/108233688)
Expand Down