If we want to use a http proxy server in the console (i.e we are browsing with lynx) we just need to set the environment variable http_proxy:
$ export http_proxy="http://<myproxyaddress>:<myproxyport>"
$ export http_proxy="http://192.168.0.10:3128"
If we have authentication enabled we need to specify the user / pass in command line, for example in lynx it would be:
$ lynx --pauth=user:password http://www.google.com.sg
Besides http_proxy, we also have:
- https_proxy for secure http
- ftp_proxy for ftp
- no_proxy for the addresses to not to use proxy
$ export ftp_proxy="http://<myproxyaddress>:<myproxyport>"
$ export no_proxy="localhost, 127.0.0.1, 192.168.0.6, <other hosts or ips>"
If we want to use the proxy with apt, we can also specify the configuration in the folder /etc/apt/apt.conf.d. In my case I named the configuration item as 80proxy:
$ cat /etc/apt/apt.conf.d/80proxy
Acquire::http::Proxy "http://user:password@proxy_ip:proxy_port";
Otherwise, with the http_proxy variable we still use the proxy if we call apt-get, but if you like to schedule an apt-get update in the crontab this approach is kind of better.
This comment has been removed by a blog administrator.
ReplyDelete