一、手动修改配置文件
1、使用编辑器打开网络配置文件:sudo nano /etc/environment
2、在文件的末尾添加下面的内容,以设置HTTP和HTTPS代理服务器:
http_proxy="http://proxy_server_ip:proxy_server_port/"
https_proxy="https://proxy_server_ip:proxy_server_port/"
export http_proxy="http://192.168.3.108:10808"
export https_proxy="http://192.168.3.108:10808"
or
http_proxy="http://192.168.3.108:10808"
https_proxy="http://192.168.3.108:10808"
将"proxy_server_ip"替换为实际的代理服务器IP地址,将"proxy_server_port"替换为代理服务器的端口号。如果代理服务器需要身份验证,可以在URL中添加用户名和密码。
3、保存并关闭文件,然后重新加载环境变量:source /etc/environment
4、配置APT软件包管理器使用代理服务器:sudo nano /etc/apt/apt.conf
5、添加以下行,将APT指令路由到代理服务器上:
Acquire::http::Proxy "http://proxy_server_ip:proxy_server_port/";
Acquire::https::Proxy "https://proxy_server_ip:proxy_server_port/";
Acquire::http::Proxy "http://192.168.3.108:10808"
Acquire::https::Proxy "http://192.168.3.108:10808";
同样,将"proxy_server_ip"替换为实际的代理服务器IP地址,将"proxy_server_port"替换为代理服务器的端口号。
6、保存并关闭文件。
7、测试连通性
curl -v http://www.google.com

Comments NOTHING