apt-get proxy 设置

来源:互联网 发布:二战日本兵力知乎 编辑:程序博客网 时间:2024/04/29 03:30

最近,因为要研究一个C语言编写的项目Aravis,不得不起用快半年不用的linux系统,而公司是通过一台proxy与外界联系的,但回到家里,又不用proxy;

proxy切换较频繁,网上的中文资料很多,但大多很片面,混淆自己的视听,所以写个博文记下,方便自己以后浏览。

设置方法有三种(一般上只需要其中一种就好,如果用第二种方法,第一种方法和第三种方法都不会起作用):

1.这是较常用的方法,修改/etc/apt/apt.conf,加入以下内容:

Acquire::http::Proxy "http://wilson_ke:password@10.0.0.1:63333";
Acquire::https::Proxy "http://wilson_ke:password@10.0.0.1:63333";
Acquire::ftp::Proxy "http://wilson_ke:password@10.0.0.1:63333";


2.修改/etc/bash.bashrc,加入以下内容:

export http_proxy=http://wilson_ke:password@10.0.0.1:63333
export https_proxy=http://wilson_ke:password@10.0.0.1:63333
export ftp_proxy=http://wilson_ke:password@10.0.0.1:63333


3.修改/etc/environment,加入以下内容:

http_proxy=http://wilson_ke:password@10.0.0.1:63333
https_proxy=http://wilson_ke:password@10.0.0.1:63333
ftp_proxy=http://wilson_ke:password@10.0.0.1:63333


4.修改~/.bashrc

http_proxy=http://wilson_ke:password@10.0.0.1:63333
https_proxy=http://wilson_ke:password@10.0.0.1:63333
ftp_proxy=http://wilson_ke:password@10.0.0.1:63333






0 0
原创粉丝点击