curl 设置 代理
sudo curl -x “http://192.168.1.2:3128”
需要验证的代理
sudo curl -x “http://username:password@192.168.1.2:3128”
另一种临时代理
export http_proxy=http://<proxy>:<port>
export https_proxy=http://<proxy>:<port>
sudo -E add-apt-repository ppa:linaro-maintainers/toolchain
https://askubuntu.com/questions/53146/how-do-i-get-add-apt-repository-to-work-through-a-proxy
如果没有代理配置文件就创建一个sudo touch /etc/apt/apt.conf.d/proxy.conf
编辑配置sudo vim /etc/apt/apt.conf.d/proxy.conf
Acquire::http::Proxy "http://[username]:[password]@ [proxy-web-or-IP-address]:[port-number]";
Acquire::https::Proxy "http://[username]:[password]@ [proxy-web-or-IP-address]:[port-number]";
输入 sudo apt update
测试
参考
https://linuxiac.com/how-to-use-apt-with-proxy/
https://phoenixnap.com/kb/ubuntu-proxy-settings
设置清华源
Ubuntu 的软件源配置文件是 /etc/apt/sources.list
。将系统自带的该文件做个备份,将该文件替换为下面内容,即可使用选择的软件源镜像。文章来源:https://www.toymoban.com/news/detail-752315.html
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
参考
https://zhuanlan.zhihu.com/p/251009600
https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/文章来源地址https://www.toymoban.com/news/detail-752315.html
到了这里,关于ubuntu 22.04 设置 apt 代理 配置 清华源 add-apt-repository 代理的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!