各种代理设置方法
2011-11-20 15:13
288 查看
在实验室需要通过代理上网,所以经常遇到需要设置代理达情况,不管是用apt安装软件还是编写程序,。
1,设置apt-get的代理(unbuntu系统):
These are three methods of using apt-get with a http-proxy.
This is a temporary method that you can manually use each time you want to use apt-get through a http-proxy. This method is useful if you only want to temporarily use a http-proxy.
Enter this line in the terminal prior to using apt-get (substitute your details for yourproxyaddress and proxyport).
This method uses the apt.conf file which is found in your /etc/apt/ directory. This method is useful if you only want apt-get (and not other applications) to use a http-proxy permanently.
Add this line to your /etc/apt/apt.conf file (substitute your details for yourproxyaddress and proxyport).
Save the apt.conf file.
This method adds a two lines to your .bashrc file in your $HOME directory. This method is useful if you would like apt-get and other applications for instance wget, to use a http-proxy.
Add these lines to the bottom of your ~/.bashrc file (substitute your details for yourproxyaddress and proxyport)
Save the file. Close your terminal window and then open another terminal window or source the ~/.bashrc file:
Test your proxy with sudo apt-get update and whatever networking tool you desire. You can use firestarter or conky to see active connections.
If you make a mistake and go back to edit the file again, you can close the terminal and reopen it or you can source ~/.bashrc as shown above.
If you need to login to the Proxy server this can be achieved in most cases by using the following layout in specifying the proxy address in http-proxy. (substitute your details for username, password,
yourproxyaddress and proxyport)
1,设置apt-get的代理(unbuntu系统):
These are three methods of using apt-get with a http-proxy.
Temporary proxy session
This is a temporary method that you can manually use each time you want to use apt-get through a http-proxy. This method is useful if you only want to temporarily use a http-proxy.Enter this line in the terminal prior to using apt-get (substitute your details for yourproxyaddress and proxyport).
export http_proxy=http://yourproxyaddress:proxyport
APT configuration file method
This method uses the apt.conf file which is found in your /etc/apt/ directory. This method is useful if you only want apt-get (and not other applications) to use a http-proxy permanently.![]() On some installations there will be no apt-conf file set up. This procedure will either edit an existing apt-conf file or create a new apt-conf file. |
gksudo gedit /etc/apt/apt.conf
Add this line to your /etc/apt/apt.conf file (substitute your details for yourproxyaddress and proxyport).
Acquire::http::Proxy "http://yourproxyaddress:proxyport";
Save the apt.conf file.
BASH rc method
This method adds a two lines to your .bashrc file in your $HOME directory. This method is useful if you would like apt-get and other applications for instance wget, to use a http-proxy.gedit ~/.bashrc
Add these lines to the bottom of your ~/.bashrc file (substitute your details for yourproxyaddress and proxyport)
http_proxy=http://yourproxyaddress:proxyport export http_proxy
Save the file. Close your terminal window and then open another terminal window or source the ~/.bashrc file:
source ~/.bashrc
Test your proxy with sudo apt-get update and whatever networking tool you desire. You can use firestarter or conky to see active connections.
If you make a mistake and go back to edit the file again, you can close the terminal and reopen it or you can source ~/.bashrc as shown above.
source ~/.bashrc
How to login a proxy user
If you need to login to the Proxy server this can be achieved in most cases by using the following layout in specifying the proxy address in http-proxy. (substitute your details for username, password,yourproxyaddress and proxyport)
http_proxy=http://username:password@yourproxyaddress:proxyport
相关文章推荐
- 【Grails 代理Proxy设置】部署Grails遇到Error Resolve error obtaining dependencies:错误,及解决方法
- 使用genymotion和chares网络调试设置代理方法
- 给SVN设置代理的方法
- Ruby gem的proxy代理设置方法
- java读取配置文件的几种方法 设置代理
- centos服务器设置代理上网的方法
- 各种Blog的API地址和设置方法
- git代理设置方法解决
- 为YUM设置代理的方法 ccproxy
- linux下各种代理的设置
- Linux(Ubuntu)下设置环境变量的各种方法
- centos服务器设置代理上网的方法
- 保护眼睛的颜色和各种背景颜色设置方法
- pip 设置代理的方法
- Chrome设置本地代理无法访问localhost的解决方法(转)
- css3中通过设置box-pack和box-align让div里面的各种元素垂直和水平居中的方法
- Python爬虫设置代理IP和伪装成浏览器的方法
- 通过三种方法为apt-get设置http代理服务
- WebBrowser控件的代理设置方法