1

In our company we have multiple raspberry pi's in our network. These devices don't have access to the internet however. We would like to keep our devices up to date and since it would be a lot of work to constantly get the individual pi's, hook them up to a cable that does have access to the internet and update them, I was wondering if there is a way to automate the process.

For example have one pi at a central location (with access to internet of course) that downloads all the updates and other devices on the network can access these updates over the local network and install them.

Is this possible and how would I go about in doing this? Unfortunately I don't have much experience with Linux.

We mostly have Raspberry pi 2's and 3's, one raspberry revolution and probably a Pi B+ here and there.

Thank you for your advice

  • Take a look at apt-mirror, you can use that to build and keep current a local Debian mirror for LAN based systems. packages.debian.org/buster/apt-mirror – Dougie May 29 at 15:49
  • You could have a look at balena.io/open but this is more complex as it reaches into application support and updates - not just OS patches. Also it's beta :( – Andyroo May 29 at 20:22
2

To keep your RasPis with Raspbian up to date, you have to use its packet manager, mainly managed with apt or apt-get. With different installations on the RasPis and with its package dependencies I don't see another usable solution. So the first idea is to create a mirror of the Raspbian repository on the main RasPi, because only it has access to the internet and a wired connection to the local network. But with a look at Setting up a Debian archive mirror you will find that it isn't a good idea because of the needed extended resources:

  • Do I have the resources to host a mirror? Mirrors take up considerable disk space and bandwidth, one has to be able to commit to the cost.
  • Is a mirror the right choice? If you primarily want to support users at your ISP/facility, then maybe a caching proxy such as apt-cacher-ng, squid, or varnish might be the better choice.

So for your application the suggested caching proxy server is a good idea. You address the local proxy server on the main RasPi as the address for the Raspbian repository server and it will redirect the traffic to the real Raspbian repository on the internet. The proxy will also cache already requested pages (packages) and first serve them from its local cache if already available from previous requests, before connecting to the remote repository. With the security settings of the proxy and/or with the firewall nftables you can ensure that you do not have access to the internet, but only to the Raspbian repository.

Try to use one of the suggested proxies apt-cacher-ng, squid, or varnish. For support of this you should better ask at https://serverfault.com/ because this isn't a native question for Raspberry Pi.

| improve this answer | |
-1

I would write a simple program with python or C to do this. Then run the program with rc.local service. Do some searches with google to see how to use rc.local or go to the official raspberry pi website https://www.raspberrypi.org/ for more research. Hope that helps you. :)

| improve this answer | |
  • 1
    Please take note that using /etc/rc.local has limitations due to Compatibility with SysV. We have seen many problems here on this site using it. Following the recommendation of the developers from systemd you should avoid using it. – Ingo Jun 1 at 10:41
  • Well rc.local has always worked for me. Sorry, I was only trying to help. – UNKNOWN Jun 2 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.