In order to get the apt-get update/upgrade/install
commands to work, I have added proxy information to my /etc/environment
file. For example:
http_proxy="http://proxy-chain.acmewidgets.com:8080/"
https_proxy="https://proxy-chain.acmewidgets.com:8080/"
ftp_proxy="ftp://proxy-chain.acmewidgets.com:8080/"
socks_proxy="socks://proxy-chain.acmewidgets.com:8080/"
Then, and this is important for my setup (not sure why - that is my question), I have to enter super user mode in order to get apt-get
to work. Like I said, I'm not sure why, but simply prefacing the aforementioned apt-get commands with sudo
does not work for me. For example, when I do sudo apt-get update
, the terminal window hangs like so:
somedude@ACME-WIDGETS-03:~$ sudo apt-get update
0% [Connecting to us.archive.ubuntu.com (91.189.91.13)] [Connecting to security
What works is entering sudo su
at the command line and then running the apt-get
commands WITHOUT prefacing with sudo
. I have to do this even if I am working in a super user terminal (opened by executing sudo gnome-terminal
). Until I issue that sudo su
command at the prompt, the proxy settings in /etc/environment
are not seen. I checked this by doing echo $http_proxy
before and after the su
; before: nothing came back, after: what was set in /etc/environment
came back.
Not a big deal, because I am able to get my updates and do my installations; but the idea with Ubuntu is to use sudo so that you don't do damage accidentally while in super user mode. So what is going on do you think? Thanks.
/etc/apt/apt.conf
askubuntu.com/questions/257290/configure-proxy-for-apt?-E
does exactly that.sudo -i -u root
(so you start a login session as that user) would be my next choice. If what you want is for apt-get to use a proxy as required by your network (note, orthogonal to sudo's handling of env variables) definitely my preferred option is just setting the proxies in the appropriate config file for apt-get as muru suggested.