ubuntu12代理设置

来源:互联网 发布:常用办公软件 编辑:程序博客网 时间:2024/05/22 09:39
一、Firefox代理上网
这个最简单了,依次点击 edit->preferences-> Advanced->network->settings 在里面填写代理服务器的IP,Port就可以了。

二、临时通过http代理使用apt-get
在使用apt-get之前,在终端中输入以下命令:
export http_proxy=http://yourProxyAddress:proxyPort

取消代理使用:
export http_proxy=""

三、设置apt-get永久使用http代理
sudo vi /etc/apt/apt.conf在您的apt.conf文件中加入下面这行:
Acquire::http::Proxy "http://yourProxyAddress:proxyPort";
保存apt.conf文件即可

四、设置全局代理上网(apt-get, wget 等等)
vi ~/.bashrc在您的.bashrc文件末尾添加如下内容:
export http_proxy="http://yourProxyAddress:proxyPort"
保存文件,重新开启终端。

经过以上设置,你就可以使用ubuntu在网络中畅游啦……


注意:请根据您的实际情况替换yourProxyAddress和proxyPort


以下内容参考:少帅的天空博文(http://blog.chinaunix.net/uid-20940095-id-3209902.html)


也许你已经尝试了上述三种方法,但还是不能通过apt-get安装软件,也不能通过wget下载。
可以通过下面的命令来安装:

>sudo apt-get install $softwareName -o Acquire::http::proxy="http://yourProxyAddress:proxyPort/"

当然,apt-get 还有个-c选项,可以用来指定使用哪个proxy配置文件。所以,也可以把所有的代理的配置写在文件中,然后执行:
>sudo apt-get -c ~/apt_proxy.conf

配置文件的格式,如下:
 Acquire::http::proxy "http://yourProxyAddress1:proxyPort/"; Acquire::ftp::proxy "ftp://yourProxyAddress2:proxyPort/"; Acquire::https::proxy "https://yourProxyAddress3:proxyPort/";

配置文件对于添加多个proxy address比较方便。


wget代理设置

>wget -e http-proxy=proxy.satwe.com:8080 –proxy=on –proxy-user=hamo –proxy-passwd=8888 -c http://www.satwe.com