Those who use Ubuntu in internet-restricted area such as college or office, probably will need proxy configuration for their apt-get command. Especially in the college, when every student given username and password for campus proxy to connect to the internet. Actually we just need to configure proxy or with/without authentication in apt.conf file. Here we go.

Assumptions


Let assume we have these credential information:

  • Proxy server: proxy.server.edu
  • Port: 443
  • Username: myusername@mycollege.edu
  • Password: mypassword

How To Configure


  1. Open Terminal.
  2. Perform command: sudo gedit /etc/apt/apt.conf
  3. Type the configuration text below.
  4. Save Gedit and exit. 
  5. Test command sudo apt-get update when you are in the proxified area.

How To Revert Configuration


  1. Open Terminal. 
  2. Perform command: sudo gedit /etc/apt/apt.conf
  3. Type a "#" sign without quotes in every beginning of line exactly before Acquire
  4. Save Gedit and exit.
  5. Test command sudo apt-get update when you are not in proxyfied area.

Configuration Text


Given above assumptions, so our configuration will be like these.
Acquire::http::proxy "http://myusername@mycollege.edu:mypassword@proxy.college.edu:443"
Acquire::https::proxy "myusername@mycollege.edu:mypassword@proxy.college.edu:443";


, , , , ,