Pages

Friday, September 23, 2011

Updating Packages behind prxy server in UBUNTU 11.10

Problem :  apt-get , Update Manager not able to download packages behind college/comapny proxy server.

Note : Sometimes there may be connection failure because of busy servers. So Please be patient during new Ubuntu release

Solution :
 
1) Open the Terminal and type the following command
     sudo gedit /etc/apt/apt.conf.d/02proxy

Note : 01proxy file is not present earlier.

2) Type the following line(in red) in the file:
     Acquire::http::Proxy “http://yourusername:yourpassword@yourproxy:yourport″;
    
Acquire::http::Proxy "http://foss:3189";
   


3) Save the file and your problem is solved.




36 comments:

  1. You are life saver. Thank you very much for this post.

    ReplyDelete
  2. I almost gave up on having a working ubuntu behind proxy. Man, ubuntu is becomin like windows, with every new version more and more things work worse or don't work at all, but oh, it looks so much nicer x(.

    Anyway, tanks a lot

    ReplyDelete
  3. SWEEEETTT!!!!!

    I also gave up

    ReplyDelete
  4. Thanks allot
    in home i removed the file but the apt-get no longer works
    so how can i remove the proxy from terminal ?
    Thanks

    ReplyDelete
  5. Just a correction, In the example add semicolon at end of the line.

    Acquire::http::Proxy “http://yourusername:yourpassword@yourproxy:yourport″;

    **It worked fine**
    Thanks :)

    ReplyDelete
  6. @Anonymous Oct 22

    I am out on vacation. Will check it after coming home

    @Anonymous Oct 24

    Thanks for the correction :)

    ReplyDelete
  7. Still not working... :(

    ReplyDelete
  8. Didn't work, when running apt I get an error message referring to the 02proxy file created by following this guide which says "junk at end of file"

    ReplyDelete
  9. @Anonymous(Nov 13)

    This is a syntax problem. Please Check that all the symbols are correctly placed.
    It is working fine on my system.

    ReplyDelete
  10. @ Anonymous(Nov 13)

    I too got the same error. It is the problem due to copy and past from this site in your editor. The double quotes is converted into to some other character. After pasting, please remove the double quotes and type it in your editor and save. I hope this will resolve your problem also

    @Naveen.. Thanx a lot buddy. You saved my time

    ReplyDelete
  11. Naveen . . .. U r Awesome!! :))

    ReplyDelete
  12. Thanks very much....You saved my day!!!!

    ReplyDelete
  13. hey what happens if you ahve @ in your password. should i escape them? if so how?

    ReplyDelete
    Replies
    1. you can put '\' in front of special characters. DO NOT USE QUOTES.

      Ex:
      Acquire::http::Proxy "http://yourusername:yourpassword@yourproxy:yourport″;

      Acquire::http::Proxy "http://yourusername:pass\@word@yourproxy:yourport″;

      This should work. Try and tell me whether this thing works or not.

      Delete
  14. thanks!! i was just smashing my head against the table for the past two hours.

    ReplyDelete
  15. tried the above but still getting the error (407 proxy authentication required). my username has '\' (backslash character) how do i work around this?

    ReplyDelete
  16. This is a syntax problem. Please Check that all the symbols are correctly placed.
    It is working fine on my system.

    ReplyDelete
  17. You should be able to quote a backslash with another backslash:

    SILLYDOMAIN\\user:p\@ssword@1.1.1.1:8080

    E

    ReplyDelete
  18. hey man, works great! works too for 12.04!

    ReplyDelete
  19. i tried the very same thing but it replied " command not found"

    actually my friend had once done the proxy settings for my terminal nd now he is out and i need to change my proxy settings....can u suggest me as to how to go from the scratch of editing the proxy settings as i am new to ubuntu

    ReplyDelete
    Replies
    1. Do you have gedit installed in your system?

      You can follow these steps
      1. Go to /etc/apt/apt.conf.d/ folder.
      2. Create a file with name as 02proxy
      3. Enter the line given below by replacing your proxy settings.

      Acquire::http::Proxy “http://yourusername:yourpassword@yourproxy:yourport″;

      4. Save and exit
      5. END

      Delete
  20. you are a life saver, just installed ubuntu 12.04 beta on proxy and i was struggling updating system.... big ups!! :-)

    ReplyDelete
  21. Facing same problem in 12.04.. Any solution??

    ReplyDelete
  22. Thanks.. the same solution works for 12.04 too...

    ReplyDelete
  23. Hello I'm using Ubuntu server 12.04 behind a proxy, I was having trouble to do updates and that didn't work.
    However, I commented out that definition in file etc/apt/apt.conf (# Acquire::http::Proxy "http://yourproxy:yourport″;) and strangely that solved the issue.
    Now works fine. Go figure!

    ReplyDelete
  24. Hello !

    I've had the same problem. My ubuntu box is behind a proxy and needs a user and password. Seems to work, if I use in System Settings -> Network -> Proxy
    the following for HTTP, HTTPS, FTP and Socks Host :

    proxy_username:proxy_password@proxy_ip

    instead of

    proxy_ip

    only.

    Example :

    bob:TopSecret@192.168.33.2

    bob = Proxy username
    TopSecret = Proxy Password of bob
    192.168.33.2 = Proxy IP

    ReplyDelete
  25. Great Help
    I too almost gave up decided this is the last thing
    and wohooo it worked

    Thanks man

    ReplyDelete
  26. stiil not working error:-

    (gedit:3350): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.1W01EW': No such file or directory

    (gedit:3350): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory

    (gedit:3350): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.L922EW': No such file or directory

    (gedit:3350): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory

    ** (gedit:3350): CRITICAL **: _gedit_tab_save_as: assertion `(tab->priv->state == GEDIT_TAB_STATE_NORMAL) || (tab->priv->state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) || (tab->priv->state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)' failed

    (gedit:3350): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.GLDDFW': No such file or directory

    (gedit:3350): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory
    manuj@manuj-VPCEH26EN:~$ sudo gedit /ect/apt/apt.conf.d/02proxy

    (gedit:3370): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.DY46EW': No such file or directory

    (gedit:3370): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory

    (gedit:3370): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.L830EW': No such file or directory

    (gedit:3370): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory

    ** (gedit:3370): CRITICAL **: _gedit_tab_save_as: assertion `(tab->priv->state == GEDIT_TAB_STATE_NORMAL) || (tab->priv->state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) || (tab->priv->state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)' failed
    sys:1: GtkWarning: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.QUT0EW': No such file or directory
    sys:1: GtkWarning: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory
    sys:1: GtkWarning: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.QD4VEW': No such file or directory
    sys:1: GtkWarning: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.51MAFW': No such file or directory
    sys:1: GtkWarning: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.M6N0EW': No such file or directory

    please tell me what to do........

    ReplyDelete
  27. fuck ..
    it has nothing to do with 12.04..
    i am frustrated ..

    ReplyDelete
  28. Thanks man...works for Ubuntu 12.04 as well..!!

    ReplyDelete
  29. If your login is like this:
    Domain\login
    replace the \ by %5C

    Acquire::http::Proxy “http://Domain%5Clogin:yourpassword@yourproxy:yourport″;

    ReplyDelete
  30. Thanks a lot.

    Your help ist greatly appreciated, saved me lots of time and led me out of a valley of desparation.

    Works fine for 12.04

    ReplyDelete
  31. works in Ubuntu 12.04 x64

    ReplyDelete
  32. still not working, after making the changes i tried sudo apt-get install vlc and this is what i got:
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package vlc

    ReplyDelete
  33. This worked, thanks. It really annoys me that Ubuntu keeps changing stuff for no good reason, in my 10.04 LTS servers all i have to do is edit /etc/apt/apt.conf but now I have to do it this way. They also made resolv.conf dynamic for no good reason and I can't directly edit it anymore...

    ReplyDelete