1

I'm trying to install a package (android-studio) through ppa, and am having some troubles. I'm 95% sure it is related to the corporate proxy we're behind of.

These are my settings:

env | grep -i proxy
http_proxy=http://1.2.3.4:5678/
ftp_proxy=http://1.2.3.4:5678/
socks_proxy=socks://1.2.3.4:5678/
https_proxy=http://1.2.3.4:5678/

set | grep -i proxy
ftp_proxy=http://1.2.3.4:5678/
http_proxy=http://1.2.3.4:5678/
https_proxy=http://1.2.3.4:5678/
socks_proxy=socks://1.2.3.4:5678/
      -p --http-proxy --no-http-proxy\
      -p --http-proxy --no-http-proxy\
      -p --http-proxy --no-http-proxy\
      -p --http-proxy --no-http-proxy\
      -p --http-proxy --no-http-proxy\
      -p --http-proxy --no-http-proxy\
      -p --http-proxy --no-http-proxy\

Then, when I execute the command, the process gets stuck while trying to download the package from terminal.

sudo apt-get install android-studio
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias       
Leyendo la información de estado... Hecho
Paquetes sugeridos:
  default-jdk
Se instalarán los siguientes paquetes NUEVOS:
  android-studio
0 actualizados, 1 se instalarán, 0 para eliminar y 2 no actualizados.
4 no instalados del todo o eliminados.
Se necesita descargar 0 B/36,2 kB de archivos.
Se utilizarán 98,3 kB de espacio de disco adicional después de esta operación.
(Leyendo la base de datos ... 885309 ficheros o directorios instalados actualmente.)
Preparando para desempaquetar .../android-studio_162.3934792~trusty_amd64.deb ...
--2017-05-18 10:37:30--  https://dl.google.com/dl/android/studio/ide-zips/2.3.2.0/android-studio-ide-162.3934792-linux.zip
Resolviendo dl.google.com (dl.google.com)... 216.58.202.206, 2800:3f0:4001:815::200e
Conectando con dl.google.com (dl.google.com)[216.58.202.206]:443... 

PS: I can download the file through browser, and using wget from terminal

Does any1 know how I could solve this, even if I have to use a temporal setting or command?

Thanks

Enrique
  • 339

2 Answers2

0

From my experience, terminal does not respect gnome system settings.

When we had a coporate proxy, we needed to set those in .bashrc. So, set your proxy in ~/.bashrc by adding these lines to the end of the file and try again (it might be enough to set http and https proxy only, but you never know...) :

export http_proxy=http://1.2.3.4:5678/
export ftp_proxy=http://1.2.3.4:5678/
export socks_proxy=socks://1.2.3.4:5678/
export https_proxy=http://1.2.3.4:5678/

.bashrc is executed every time you start up a terminal. So do not forget to close and reopen your terminal after saving .bashrc.

Good luck and have fun.

mondjunge
  • 3,336
0

I've created a script to make it easier for the new user to record their proxy credentials without relying on a third party. Modify the proxy addresses for your (ironport ...)

#!/bin/bash

clear
if [ $(id -u) != "0" ]; then
    echo "You must be the superuser to run this script" >&2
    exit 1
fi



echo "******************************************************************************"
echo "*                                                                            *"
echo "*                                                                            *"
echo "*                          Salvar credenciais no PC                          *"
echo "*                                                                            *"
echo "*                                                                            *"
echo "******************************************************************************" 
echo                                                                            
echo "Digite sua m#chmod 755 $HOME/script/enviromentatricula do XXX de até 4 digitos"
read matricula    
clear #!/bin/bash
echo "******************************************************************************"                                                       
echo "*                                                                            *"
echo "*                       Sua matricula é $matricula                           *"
echo "*                                                                            *"
echo "******************************************************************************"
echo "Digite sua senha do TRT" 
read -s senha
echo "************************* Criando arquivos **********************************"
local="http://"$matricula":"$senha"@ironport.br:80/"
local1="https://"$matricula":"$senha"@ironport.br:80/"
local2="ftp://"$matricula":"$senha"@ironport.br:80/"
local3="socks://"$matricula":"$senha"@ironport.br:80/"
#echo -e "HTTP_proxy $local \nFTP_proxy=$local \nHTTPS_proxy=$local \n" "http_proxy=$local \n""ftp_proxy $local \n""https_proxy $local"
echo -e "HTTP_proxy=$local \nFTP_proxy=$local \nHTTPS_proxy=$local \nhttp_proxy=$local \nftp_proxy=$local \nhttps_proxy=$local" > tmpfile
#mv tmpfile $HOME/script/enviroment
#chmod 755 $HOME/script/enviroment
#mv tmpfile /etc/enviroment
cat tmpfile > $HOME/script/environment
cat tmpfile > /etc/environment
chmod 755 /etc/enviroment
echo -e "Acquire::http::proxy \"$local\"; \nAcquire::https::proxy \"$local1\"; \nAcquire::ftp::proxy \"$local2\"; \nAcquire::socks::proxy \"$local3\"; "> apt
#mv apt $HOME/script/apt.conf
#mv apt /etc/apt/apt.conf
cat apt.txt > $HOME/script/apt.conf
cat apt.txt > /etc/apt/apt.conf
clear 
echo "******************************************************************************"
echo "*                                                                            *"
echo "*         Arquivos gravados com sucesso                                      *"
echo "*         /etc/environment                                                   *"
echo "*         /etc/apt/apt.conf                                                  *"
echo "*                                  Cópia de I                                          *"
echo "******************************************************************************" 
echo " testar configuração digite S" Cópia de I
read testar
if [ $testar = "S" ]; then
    apt-get update
fi

save as arquivo.sh and chmod -x ./arquivo.sh and run ./arquivo.sh

To test without the super user comment (#) lines 4, 5, 6 and 7

derHugo
  • 3,376
  • 5
  • 34
  • 52
Max
  • 31