type
status
slug
summary
tags
category
icon
password
new update day
Property
Oct 22, 2023 01:31 PM
created days
Last edited time
Oct 22, 2023 01:31 PM
有时候会遇到服务器不在透明代理环境下,而我们与需要安装的软件下载源连接性不稳定,这个时候我们可能就需要临时为 apt 包管理器启用一下代理。
apt 代理设置主要可以分为以下三种方式。
1 环境变量方法
这种方式会设置的代理只在当前会话用户与 shell 中存在(也就是说应该直接 root 用户执行,不能使用 sudo 否则环境变量会失效)
2 临时命令带入
只需要在使用 apt 包管理器的时候,在命令行后面增加如下
-o
选项3 修改 apt 包管理器的配置文件
修改
/etc/apt/apt.conf
,增加如下配置:这种方式会将代理设置持久化配置,但是不够灵活,如果代理出现问题需要再次修改配置文件进行调整。
- Author:tangcuyu
- URL:https://expoli.tech/articles/2022/12/16/config-proxy-for-apt-package-manager
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
Relate Posts