Search code examples
pythonlinuxubuntuproxyvirtualbox

How to set proxy for terminal in ubuntu?


My scenario:

I am trying to install python and postgresql in my newly installed ubuntu which runs through virtualbox on windows 7. It uses my companys network and I have set the proxy in the network settings of ubuntu.

I can browse and download using mozilla(ubuntu) with no problem.

Problem:

But when I try to install packages using terminal, it just stops at 0%. It tries various IP's, still at 0% my terminals screenshot

[update] - it ended in unable to connect to IP

Tried:

I have already tried export proxy settings through

sudo -H gedit /etc/profile.d/proxy.sh

and updated the file with

export http_proxy=http://username:password@proxyhost:port/

(also I've set for https)

Please let me know what's the problem going on ?


Solution

  • To Set Proxy in Ubuntu:

    Edit the /etc/apt/apt.conf file and add the following:

    Acquire::http::proxy "http://ProxyHOST:ProxyPORT/";
    Acquire::https::proxy "https://ProxyHOST:ProxyPORT/";
    

    Hope it Helps.. :)