简体   繁体   中英

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 ?

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!.

Found the answer,

Please click here

export option doesn't work for this kinda scenario

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM