Ubuntu – How to access internet and run apt-get through a middle server


I have a machine running ubuntu 16.04. The machine can only access 1 remote server (also running ubuntu). The remote server has full access to internet though.

root@localmachine:~# ifconfig usb0
usb0      Link encap:Ethernet  HWaddr 02:1e:10:1f:00:00  
          inet addr:  Bcast:  Mask:
          RX packets:4366027 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1813925 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:669835698 (669.8 MB)  TX bytes:265999026 (265.9 MB)

root@localmachine:~# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=62 time=58.4 ms
64 bytes from icmp_seq=2 ttl=62 time=59.2 ms

I need to install some package on this local machine via apt-get.

Is there a way to access internet throught the public server at ?

Thank you for your reply.

Best Answer

The easiest way would be that you set up a proxy server on the middle server/gateway and set up your apt to use this proxy:

sudo vi /etc/apt/apt.conf.d/proxy.conf

And add this line:

Acquire::http::Proxy "http://user:password@proxy.server:port/";
Related Question