Connect Raspi to a Proxy


15 posts
by raspiworld » Thu Sep 27, 2012 7:52 pm
Hi, I have a problem with my internet connectivity.
I only have acces to the Internet over a proxy server. When I try to visit a website with the browser, it works, because of the proxy settings of the browser.

But when I want to install new software, there is no connection to the Internet, when I tipe in "apt-get update" for example.

Is there any posibility or setting to get access to the internet over a proxy?


Thank you!
Posts: 3
Joined: Thu Sep 27, 2012 7:45 pm
by Wendo » Sat Sep 29, 2012 2:22 am
Add the following lines to the file /etc/environment

export http_proxy="http://username:password@host:port/"
Posts: 142
Joined: Sun Jun 10, 2012 8:27 pm
by phughes » Tue Oct 02, 2012 10:09 am
Hi,

Very new to this. I have tried to edit the file as you have said, no authentication required.

export http_proxy=http://proxy.county.ac.uk:8080

This doesn't seem to do anything. Did you get it working??

Cheers,
Pete
Posts: 9
Joined: Tue Oct 02, 2012 8:55 am
Location: Colne, Lancashire, UK
by VAXXi » Tue Oct 02, 2012 11:10 am
apt seems to ignore the HTTP_PROXY environment variable.

You can make it work by putting
Code: Select all
Acquire::http::Proxy "http://yourproxyaddress:proxyport";

in a file placed in /etc/apt/conf.d (named similar to "10proxy" for example). It should also work when placed in /etc/apt/apt.conf but I don't remember if this file still exists on the latest Raspbian.
User avatar
Posts: 9
Joined: Tue Sep 25, 2012 12:04 pm
Location: Romania
by phughes » Tue Oct 02, 2012 12:23 pm
Hi,

Thanks for the reply. Looks promising, but i'm not quite sure where exactly to add the line.

The structure i have is as follows;

/etc/apt/ - contains 3 files (sources.list, trustdb.gpg & trusted.gpg)
/etc/apt/apt.conf.d - contains 3 files (70debconf, 50raspi & 01autoremove)
/etc/apt/preferrences.d - empty
/etc/apt/sources.list.d - 1 file (raspi.list)
/etc/apt/trusted.gpg.d - empty

Do I create a new file or use one of these?

Many thanks,
Pete
Posts: 9
Joined: Tue Oct 02, 2012 8:55 am
Location: Colne, Lancashire, UK
by VAXXi » Tue Oct 02, 2012 12:25 pm
Create a new file in /etc/apt/apt.conf.d/ and name it "10proxy"; put inside the long line in my above post. Apt-get should work immediately after.
User avatar
Posts: 9
Joined: Tue Sep 25, 2012 12:04 pm
Location: Romania
by phughes » Tue Oct 02, 2012 12:44 pm
Wonderful. Thank you :)
Posts: 9
Joined: Tue Oct 02, 2012 8:55 am
Location: Colne, Lancashire, UK
by phughes » Wed Oct 03, 2012 1:24 pm
Internal proxy. For internet use.

I'm getting an error using dillo; DNS failed to resolve domain\username

I have changed the file /etc/environment to read as follows;

Code: Select all
export http_proxy="http://domain\username:password@proxyip:port/"

This looks like a syntax error with my code, any suggestions?

Cheers,
Pete
Posts: 9
Joined: Tue Oct 02, 2012 8:55 am
Location: Colne, Lancashire, UK
by phughes » Thu Oct 04, 2012 7:16 am
Hi Guys,

Dillo doesn't like proxy servers I dont think. The above code works perfectly fine on the other richer browsers.

Cheers,
Pete
Posts: 9
Joined: Tue Oct 02, 2012 8:55 am
Location: Colne, Lancashire, UK
by raspiworld » Fri Oct 05, 2012 3:53 pm
Hi guys,
I tried to go to the directory using "cd /etc/apt/apt.conf.d" but the terminal says "Not a directory"
To create the "10proxy" file there I have to go in there.
Cut and paste doesn't work, too. (Permission denied)

If I try to move the file to the Folder "apt.conf.d" using "mv 10proxy /etc/apt/apt.conf.d" the file goes to "/etc/apt" and get the name "apt.conf.d".

I don't understand this. I just want to have a Internet connection on my Raspi.

Many thanks
Posts: 3
Joined: Thu Sep 27, 2012 7:45 pm
by VAXXi » Fri Oct 05, 2012 7:54 pm
Not sure about what Linux distribution you're using, but try adding a "/" at the end of the path (after apt.conf.d) and prefix the commands with sudo in order to make sure it's not a permission problem.
User avatar
Posts: 9
Joined: Tue Sep 25, 2012 12:04 pm
Location: Romania
by raspiworld » Mon Oct 08, 2012 9:41 pm
Worked fine.

Thank you!
Posts: 3
Joined: Thu Sep 27, 2012 7:45 pm
by tsantosc123 » Thu Jan 23, 2014 12:37 am
Hello, I've created the "10proxy" file and put the line said by VAXXi in it, but I still can't access apt.
I think it's because I need an username and password to connect in my proxy server.

There's something I can do to include the username and password?

Thank you.
Posts: 1
Joined: Thu Jan 23, 2014 12:21 am
by DougieLawson » Thu Jan 23, 2014 1:01 am
At a guess
Code: Select all
Acquire::http::Proxy "http://yourusername:yourpassword@yourproxyaddress:yourproxyport";
Hacker on ZX80 and Microtan65
Unemployed mainframe database specialist.
Linux hacker since 1995.
RPi owner since 2012.
Twitter: @DougieLawson

Gaffer tape is "The Force", it has a dark side and a light side and it holds the Universe together.
User avatar
Posts: 5351
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
by jneha » Mon May 26, 2014 2:59 pm
VAXXi wrote:apt seems to ignore the HTTP_PROXY environment variable.

You can make it work by putting
Code: Select all
Acquire::http::Proxy "http://yourproxyaddress:proxyport";

in a file placed in /etc/apt/conf.d (named similar to "10proxy" for example). It should also work when placed in /etc/apt/apt.conf but I don't remember if this file still exists on the latest Raspbian.




Thank you. the apt-get works in my Raspi by setting the proxy.. Thank you :)
Posts: 7
Joined: Sat May 24, 2014 7:26 am