Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a raspberry pi and I need to set a network proxy for both apt and browser.

How do I do this?

The only thing I have found is to use the following lines in the bash.bashrc file

export http_proxy=http://username:password@proxyhost:port/
export ftp_proxy=http://username:password@proxyhost:port/

However I do not have a username or password as the proxy does not require authentication.

share|improve this question

migrated from stackoverflow.com Jan 8 '13 at 13:15

This question came from our site for professional and enthusiast programmers.

Just add to your .bashrc:

export http_proxy=http://proxyhost:port

export ftp_proxy=http://proxyhost:port

If you don't neeed authentication just don't add it.

share|improve this answer
    
Ok, I have now added the lines http_proxy=***.**.***.**:**** and ftp_proxy=***.**.***.**:**** to the bottom of my bash.bashrc file (obviously with real ips rather than asterix) But I still have no access to the net..... do I need to do anything else? – coolblue2000 Jan 8 '13 at 11:34
1  
Did you logged out and logged in again so the .bashrc gets sourced? – Atropo Jan 8 '13 at 11:38
    
I restarted the pi and it loaded up fine. However the bash.bashrc file is now blank! – coolblue2000 Jan 8 '13 at 13:44
    
Ok, I forgot to include the export command at the beginning of each line. I now have access to the internet via a browser. However I still can't get access via apt I have tried adding a 01proxy file under /etc/apt/apt.conf.d/ and adding the line Acquire::http:proxy "111.111.111.111:1111";; but this file saves ok (I can re-open it and the information is there) but when I restart the pi I still have no apt web access and the 01proxy file is now empty again! – coolblue2000 Jan 8 '13 at 14:27
    
Ok if I use sudo apt-get -o Acquire::http::proxy 111.111.11.11:8080 update, it works fine, so it is obviously just a matter now of knowing where to set the proxy – coolblue2000 Jan 8 '13 at 15:13

Assuming you are using Raspian, create a file called 99proxy containing

Acquire::http::Proxy "http://111.111.11.11:8080";

in /etc/apt/apt.conf.d/

If your distribution does not use apt.conf.d/, put the same line in /etc/apt/apt.conf

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .