ubuntu18.04使用脚本为虚拟机配置apt代理

Feronia ·
更新时间:2024-11-14
· 830 次阅读

设置apt代理需要修改/etc/apt/apt.conf
脚本内容如下:

# file 1.sh #!/bin/bash PROXY_IP_PORT=$1 if [ -z ${/etc/apt/apt.conf} ];then echo "Please enter the Proxy IP and Port." exit 1 fi sudo sh -c 'echo " Acquire::http::proxy \"http://127.0.0.1:8000/\"; Acquire::ftp::proxy \"ftp://127.0.0.1:8000/\"; Acquire::https::proxy \"https://127.0.0.1:8000/\"; ">>/etc/apt/apt.conf' sudo sed -i "s/127.0.0.1:8000/${PROXY_IP_PORT}/" /etc/apt/apt.conf echo echo "--------file:/etc/apt/apt.conf---------" cat /etc/apt/apt.conf echo "---------------------------------------" exit 0

直接运行bash 1.sh IP:PORT
即可完成配置


作者:ronnie88597



ubuntu apt 虚拟机 脚本

需要 登录 后方可回复, 如果你还没有账号请 注册新账号