Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
apt-get does not work with proxy

I am a newbie to Ubuntu/Linux. I am using Ubuntu in office campus and we have a proxy server. I want to update or install new software like flash ,media player, networking tools etc., but I am unable to install from the Synaptic Package Manager.

I have created an apt.conf file which contains Acquire::http::Proxy ""; I also have an apt.conf.d file but its empty and I don't know what to do with this file.

This is the error I encounter when I try to update:

E: Syntax error /etc/apt/apt.conf.d/proxy:3: Extra junk at end of file
E: Syntax error /etc/apt/apt.conf:2: Extra junk at end of file
share|improve this question

marked as duplicate by James, Jjed, jokerdino, Jorge Castro, fossfreedom Jan 31 '12 at 19:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Could you add the out put of the following two commands: sudo head -n 3 /etc/apt/apt.conf.d/proxy and sudo head -n 2 /etc/apt/apt.conf? Thanks. – qbi Sep 15 '11 at 12:31
Note that /etc/apt/apt.conf.d should be a directory, not a file. – Piskvor Sep 15 '11 at 13:04

I've created a new file in /etc/apt/apt.conf.d/, named 01proxy:

Acquire::http { Proxy "http://apt-proxy:3142"; };

where apt-proxy is the hostname of the proxy server. Been using this since 9.04, and It Works without any issues.

share|improve this answer

First, I would try using the Network Proxy configuration GUI.

If that fails, add the following to /etc/bash.bashrc:

export http_proxy=
export ftp_proxy=

You can omit the username:password, if your proxy server has no password.


share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.