apt-get behind proxy server

Apr 6, 2010
Tested on: Ubuntu 9.10 (Karmic Koala)
  • Using Synaptic
    Navigate to Settings->Preference->Network in Synaptic package manager. Enter your proxy server details like: username:password@proxyserver, and put the proxy server port

  • Using Command Line
    Add following lines to the end of ~/.bashrc http_proxy=http://username:password@proxyserver:port/ ftp_proxy=http://username:password@proxyserver:port/ https_proxy=http://username:password@proxyserver:port/ HTTP_PROXY=http://username:password@proxyserver:port/ FTP_PROXY=http://username:password@proxyserver:port/ HTTPS_PROXY=http://username:password@proxyserver:port/ no_proxy=server1,server2 NO_PROXY=server1,server2 Replace username, password, proxyserver and port by relevant value. You can omit username:password if your proxy server do not require any authentication. All the names, like http_proxy, are obvious and self-explanatory. no_proxy can take any number of servers separated by comma. Then type following command in shell sudo visudo It will open up a text editor in shell. Add the following line at the end of the file Defaults env_keep += "ftp_proxy http_proxy https_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY NO_PROXY no_proxy" It instructs to keep the variables from user environment to the sudo environment.