Linux Proxies

When you run Linux which is not directly connected to the internet you normally encounter several problems. Things like that your linux cannot resolv a DNS name or cannot connect to specific source (couldn’t connect to host). This is normally in a corporate network where not every computer is intended to be directly connected with the internet but instead to a proxy.

Here are the most common proxy-settings I use. Just hack it into your command line interface, also called bash or terminal.

  • System Proxy
export http_proxy=http://user:password@hostname:port
export https_proxy=http://user:password@hostname:port
export ftp_proxy=http://user:password@hostname:port
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$https_proxy
export FTP_PROXY=$ftp_proxy
The last three lines are for programms which ask the proxies in upper case. I do not know if this is neccesary but it seems to be that the Ubuntu developers think so.
  • WGET Proxy
vim /etc/wgetrc
or
vi /etc/wgetrc

and add these lines

https_proxy = http://user:password@hostname:port
http_proxy = http://user:password@hostname:port
ftp_proxy = http://user:password@hostname:port
You may also need another proxy for your Ubuntu, Debian and other forks.
  • Aptitude (apt-get) Proxy (this file might not exist. Create it and save it)
vim /etc/apt/apt.conf
and add this line
Acquire::http::Proxy "http://user:password@hostname:port";
  • SVN Proxy
vim /etc/subversion/servers
search for this:
[global]
# http-proxy-exceptions = *.exception.com, www.internal-site.org
<strong>http-proxy-host = yourproxy.com http-proxy-port = yourproxyport</strong>
# http-proxy-username = defaultusername
# http-proxy-password = defaultpassword
...snip...

If you receive an error like this:

/etc/subversion/servers:71: Option expected

than you need to remove the space ‘ ‘ character in front of your line. Your proxy line must begin at position 1.

Remember the standard ports

  • HTTP: 80
  • HTTPS: 443
  • FTP: 21
Some proxyproviders also take portnumbers for http like: 8080,3128 and following.

Now you are done. Go internetting with your Linux!