2026-03-05 11:17:42 +08:00
|
|
|
|
## 用户级别
|
2026-03-05 11:17:08 +08:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
nano ~/.bashrc
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
# Proxy Configuration
|
|
|
|
|
|
export HTTP_PROXY="http://192.168.31.9:7890"
|
|
|
|
|
|
export HTTPS_PROXY="http://192.168.31.9:7890"
|
|
|
|
|
|
export http_proxy="http://192.168.31.9:7890"
|
|
|
|
|
|
export https_proxy="http://192.168.31.9:7890"
|
|
|
|
|
|
|
|
|
|
|
|
# 可选:设置不走代理的地址 (本地地址和内部域名)
|
|
|
|
|
|
export NO_PROXY="localhost,127.0.0.1,::1,192.168.*,10.*"
|
|
|
|
|
|
export no_proxy="localhost,127.0.0.1,::1,192.168.*,10.*"
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
保存并退出(`Ctrl + O` `Enter` `Ctrl + X`)
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
source ~/.bashrc
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-05 11:18:02 +08:00
|
|
|
|
## 对所有用户生效(需重启系统)
|
2026-03-05 11:17:08 +08:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
sudo nano /etc/environment
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
HTTP_PROXY="http://192.168.31.9:7890"
|
|
|
|
|
|
HTTPS_PROXY="http://192.168.31.9:7890"
|
|
|
|
|
|
http_proxy="http://192.168.31.9:7890"
|
|
|
|
|
|
https_proxy="http://192.168.31.9:7890"
|
|
|
|
|
|
NO_PROXY="localhost,127.0.0.1,::1"
|
|
|
|
|
|
no_proxy="localhost,127.0.0.1,::1"
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
保存并退出(`Ctrl + O` `Enter` `Ctrl + X`)
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
sudo reboot
|
2026-03-05 11:18:02 +08:00
|
|
|
|
```
|