Linux下代理的设置

Posted by AspenStars on March 24, 2022

wget或curl等软件的代理设置

在终端中直接运行:

1
2
export http_proxy=http://proxyAddress:port
export https_proxy=http://proxyAddress:port

如果服务启动了SSR,并且走的http的代理端口是12333,想执行wget或者curl来下载国外的东西,可以使用如下命令:

1
2
export http_proxy=http://127.0.0.1:12333
export https_proxy=http://127.0.0.1:12333

Ubuntu下APT的代理设置

创建一个代理的配置文件:

1
sudo vim /etc/apt/apt.conf.d/proxy.conf

写入一下信息

1
2
3
4
Acquire {
  HTTP::proxy "http://127.0.0.1:8080";
  HTTPS::proxy "http://127.0.0.1:8080";
}

参考资料

Linux 让终端走代理的几种方法

How to Set the Proxy for APT on Ubuntu 18.04