Linux – How to Create a Local Update Mirror and Automate It

ansibleautomationlinuxrepository

Hi i run a few different linux distributions and architectures and have some from server so slow that they update in KB/s for example with ubuntu on ARM. I'm learning up automation, how would i go about

  • creating a local only linux mirror/cache
  • updating that mirror/cache regularly automatically
  • automating the router to wake up the file server to update that cache and shutting it down when finished
  • additionally if possible, update other VMs/devices after the file server updates.

I have access to my router to create static DNS entries as well and i have a file server that consumes a lot of power when turned on but it is very fast (does gzip close to 1GB/s which is the raid's peak performance). It takes more than 200W just keeping it on and no matter what i do cant reduce the wattage to under 100W so i decided to just have it at max performance and only turn it on when i need it.

I bricked one of the ARM boards OS and cant open it up to access the SD card, as one of the ubuntu upgrades went too slow that it timed out and messed up the firmware update as an example. I figured since i use a few distros very often that i might as well have the update process done from a local cache as an exercise to learning ansible.

I would like help in learning how to do this be it here or links to resources in how to do what i'd like.

Best Answer

This is potentially a bit off topic due to the recommendation rule, but anyways...

There's a fair amount to unpack here, but I'd start with looking at:

  1. CentOS - reposync tool, Ubuntu - apt-mirror tool.
  2. cron for the scheduling
  3. Not sure you can easily automate the router, unless you can have something else send a wake-on-LAN packet to the server
  4. You could try and schedule the updates on other VMs/servers, but otherwise just having a local copy of packages is helpful.

More generally, you may want to look at things like Bash scripting or Python scripting to automate small tasks. I tend to use Bash for stuff initially, then Python if it's getting too complex, then Golang if it really needs static types or I'll be distributing the tool.

Related Topic