M BUZZ CRAZE NEWS
// news

Setting proxy for apt from terminal [duplicate]

By Emma Martinez

Possible Duplicate:
apt-get does not work with proxy

I have tried changing my proxy settings in a terminal as:

export HTTP_PROXY=

and

export http_proxy=

but when I try to install a new package or update apt-get, apt-get starts displaying messages from which it seems it is trying to connect to a previously set proxy:

sudo apt-get update
0% [Connecting to 10.1.2.2 (10.1.2.2)] [Connecting to 10.1.2.2 (10.1.2.2)

I have tried setting the proxy via bashrc file but that din work either. As far as I remember 10.1.2.2 was set using GNOME GUI but I don't have access to the GUI right now so I am trying to set it from terminal.

5

3 Answers

Okay just solved it. Adding following line to /etc/apt/apt.conf has solved the problem:Acquire::http::proxy "";

If file does not exist, create it. Do not confuse it with apt.conf.d directory.

2

The file:

/etc/environment

Is the correct place to specify system-wide environment variables that should be available to all processes. See for details. Note that this is not a script file but a configuration file.

If you want this for the specified command only, use (as root):

http_proxy= apt-get update
3

Edit your:

gedit /etc/profile

Enter the details in this format.

export http_proxy=
export ftp_proxy=

Then run the

sudo apt-get update

That should do it for you.

As stated above you can enter the proxy into apt.conf (Piyush Credit)

2