一、安装FetchDebian 在使用代理前,需先确保FetchDebian已正确安装。常见安装方式有两种:
sudo apt update && sudo apt install fetchdebian 安装完成后,通过fetchdebian --version验证是否成功。git clone https://github.com/fetchdebian/fetchdebian.git cd fetchdebian sudo apt install build-essential git python3-pip 编译并安装:./autogen.sh && ./configure && make && sudo make install 同样通过fetchdebian --version验证安装。二、配置代理加速下载 若处于网络受限环境(如企业内网、地区限制),可通过以下方式配置代理:
编辑/etc/environment文件,添加HTTP/HTTPS代理地址(替换proxy_server_ip和proxy_server_port为实际值):
sudo nano /etc/environment 在文件中添加以下内容:
http_proxy "http://proxy_server_ip:proxy_server_port/" https_proxy "https://proxy_server_ip:proxy_server_port/" 保存并退出后,运行source /etc/environment使配置生效。
编辑APT配置文件/etc/apt/apt.conf(若不存在则新建),添加以下内容:
sudo nano /etc/apt/apt.conf 添加代理规则:
Acquire::http::Proxy "http://proxy_server_ip:proxy_server_port/"; Acquire::https::Proxy "https://proxy_server_ip:proxy_server_port/"; 保存后,APT工具(如apt update、apt install)将自动使用该代理。
若仅需临时使用代理,可在运行FetchDebian命令时通过-e参数指定代理:
fetchdebian -e http://proxy_server_ip:proxy_server_port/ <package_name> 例如,下载vim软件包:
fetchdebian -e http://192.168.1.100:8080/ vim 该方式仅对当前命令有效。
三、验证代理是否生效
fetchdebian install <package_name>(如fetchdebian install htop),观察下载速度是否提升。