0

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 ?

Yogi
  • 1,561
  • 5
  • 26
  • 45
  • Possible duplicate of [Using pip behind a proxy](http://stackoverflow.com/questions/14149422/using-pip-behind-a-proxy) – Jérôme Jan 06 '17 at 09:50

4 Answers4

6

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.. :)

Sarat Chandra
  • 5,636
  • 34
  • 30
5

This will be very simple . I have created a python 3 script for this

proxy_configuration

download it and run it . You can set and remove system wide proxy very quickly.

steps: 1) Download in zip and extract it. 2) open terminal and navigate to the folder where you have extracted the file. 3) type the following commands
chmod +x proxy.py
sudo ./proxy.py

cheers!.

Nityananda Gohain
  • 311
  • 1
  • 3
  • 10
  • The best answer so far. I always had problem setting system wide proxy. My web browser would run fine but my terminal often could not install or update anything. Browsed through hundreds of answers but none of them worked. Finally your solution worked. Thank you so so much. – sushruta19 Apr 14 '22 at 17:31
3

Found the answer,

Please click here

export option doesn't work for this kinda scenario

Community
  • 1
  • 1
Yogi
  • 1,561
  • 5
  • 26
  • 45
0

Open Terminal Then go to directory /etc/apt/apt.conf.d using

cd /etc/apt/apt.conf.d

and then create a new file named proxy.conf with root privileges using

sudo gedit proxy.conf

Now copy and paste the following

Acquire::https::proxy "http://username:password@Port_ip:Port_Number/";

Acquire::ftp::proxy "ftp://username:password@Port ip:Port_Number/";

Be sure to replace Port_ip and Port Number with the one provided by your office or network administrator

Kuji
  • 53
  • 1
  • 5