configure apt-get and wget in ubuntu

3
Setting up Proxy Settings for apt-get and wget in Ubuntu To check if you have proxy configured in your system: env | grep proxy To setup proxy, add the following lines to these environment settings: 1) apt.conf (for apt-get) sudo gedit /etc/apt/apt.conf Acquire::http::Proxy "http://username:password@proxy:port"; Acquire::https::Proxy "http://username:password@proxy:port"; Acquire::ftp::Proxy "http://username:password@proxy:port"; 2) wgetrc (for wget) sudo gedit /etc/wgetrc https_proxy = http://username:password@proxy:port http_proxy = http://username:password@proxy:port ftp_proxy = http://username:password@proxy:port Uncomment 'use_proxy = on' Then reboot. sudo reboot After rebooting your machine, you can now use apt-get and wget normally like sudo apt-get install package-name and wget url If you don't want to change any configurations and just wanted to use proxy for the entire duration of your session: For apt-get: sudo http_proxy='http://username:password@proxy:port' apt-get install package-name For wget: export http_proxy='http://username:password@proxy:port' && wget url OR export http_proxy=http://proxy:port && wget --proxy-user=user --proxy-password=password url

Upload: pclink

Post on 11-Feb-2016

254 views

Category:

Documents


1 download

DESCRIPTION

Configure Apt-get and Wget in Ubuntu

TRANSCRIPT

Page 1: Configure Apt-get and Wget in Ubuntu

Setting up Proxy Settings for apt-get and wget in Ubuntu

To check if you have proxy configured in your system:env | grep proxy

To setup proxy, add the following lines to these environment settings:

1) apt.conf (for apt-get)

sudo gedit /etc/apt/apt.conf

Acquire::http::Proxy "http://username:password@proxy:port";Acquire::https::Proxy "http://username:password@proxy:port";Acquire::ftp::Proxy "http://username:password@proxy:port";

2) wgetrc (for wget)

sudo gedit /etc/wgetrc

https_proxy = http://username:password@proxy:porthttp_proxy = http://username:password@proxy:portftp_proxy = http://username:password@proxy:port

Uncomment 'use_proxy = on'

Then reboot. sudo reboot

After rebooting your machine, you can now use apt-get and wget normally like sudo apt-get

install package-name and wget url

If you don't want to change any configurations and just wanted to use proxy for the entire duration of your session:

For apt-get:sudo http_proxy='http://username:password@proxy:port' apt-get install package-name

For wget:export http_proxy='http://username:password@proxy:port' && wget url

OR

export http_proxy=http://proxy:port && wget --proxy-user=user --proxy-password=password url

Page 2: Configure Apt-get and Wget in Ubuntu

Things to remember: 1) Use this format if your proxy doesn't require login credentials: http://proxy:port2) If your proxy server is Windows-based just like ours, don't forget to add your domain in your login.

ex. http://domain\username:password@proxy:port

3) Character escape your password if it has special characters.

ex. proxy-password=me\@123

4) If after setting up the http_proxy environment variable for wget and the connection still fails, alsoset up the https_proxy and ftp_proxy variables.

Fuente: http://annelagang.blogspot.com/2012/11/setting-up-proxy-settings-for-apt-get.html

Funciona perfecto para agregar PPA

Configurar el PROXY en UbuntuPublicado el por Dan Jared • Publicado en Ubuntu • Etiquetado como apt-get, proxy, Ubuntu • 20 comentarios

Bueno, el proxy… si el proxy… como configurarlo. Depende de que requieres pasar por el Proxy.

Empecemos con los básicos, Firefox, Chrome, Chromium, Thunderbird, Pidgin, Evolution, Banshee, Rhythmbox, etc…, estos clientes tomas la configuración del proxy de las propiedades del sistema en Proxy de la Red. Y solo es necesario colocar los datos de nuestro proxy.

Para las aplicaciones de terminal, como wget, winetrics, add-apt-repository, etc… se requiere que laconfiguración del proxy este en las variables de ambiente. Es necesario abrir una terminal para realizar las siguientes configuraciones.

$ export http_proxy=http://usuario:contraseñ[email protected]:puerto/$ export https_proxy=https://usuario:contraseñ[email protected]:puerto/

Si el proxy no tiene contraseña se puede omitir la parte de usuario:contraseña@, y debe ser algo como:

$ export http_proxy=http://proxy.dominio:puerto/$ export https_proxy=https://proxy.dominio:puerto/

Para el caso especifico de add-apt-repository no funciona si las variables se exportan en la sesión y después se ejecuta el comando con “sudo”, es necesario entrar a root.

$ sudo su -# export http_proxy=http://usuario:contraseñ[email protected]:puerto/# export https_proxy=https://usuario:contraseñ[email protected]:puerto/# add-apt-repository ppa:identificador

Page 3: Configure Apt-get and Wget in Ubuntu

Asiendo uso también de la terminal. Para dejar permanente estas variables sin tenerlas que estar configurando todo el tiempo, modificamos el archivo /etc/environment

sudo gedit /etc/environment

Y agrega las siguientes líneas:

http_proxy=http://usuario:contraseñ[email protected]:puerto/https_proxy=https://usuario:contraseñ[email protected]:puerto/

Y por ultimo como utilizar proxy en Ubuntu Software Center, o los asistentes de instalación de paquetes, como instalación de codecs, soporte a idiomas, apt-get, aptitude, etc. Para estos es necesario modificar o crear el archivo si no existe: /etc/apt/apt.conf:

$ sudo gedit /etc/apt/apt.conf

Y después agregar las siguientes líneas:

Acquire::http::Proxy "http://usuario:contraseñ[email protected]:puerto/";Acquire::https::Proxy "https://usuario:contraseñ[email protected]:puerto/";

Como mencione al inicio, si no requieres contraseña se puede omitir usuario:contraseña@

Bueno con esto terminamos con la configuración del proxy. Hasta pronto.

Fuente: http://danjared.wordpress.com/2011/03/09/configurar-el-proxy-en-ubuntu/