Having a local mirror in your homelab speeds up the update process when installing new OS's or generally updating. Most cloud providers have their own mirrors to speed up the process as well. Here is how you can make one for your lab.
A local mirrors download and serve updates to any VM or device that it has updates for. It is the equivalent of having a Windows WSUS server; all updates get downloaded by one device, and all others receive their updates from there. This is great for a lab that stays off the Internet, a security professional learning the faults and issues of the update process, a hobbyist looking to add to their homelab to keep building technical experience and more. This project is specifically covering Debian based system; I'm sure it is not too hard to replicate for the other major flavors.
Install apache and aptmirror together, as all the other systems will use http to get their updates (interestingly insecure!)
sudo apt update && sudo apt install apache2 apt-mirror -y
Apt-mirror's configuration files sit in /etc/apt/mirror.list.
The important areas in the file are:
sudo ln -s /updates /var/www/html/mirror
This way, your updates will be accessible to Apache and the clients. You can verify by using your browser and going to "http://_your_IP_address_/mirror" and see if it shows a folder.
If you run into issues with apt-mirror (such as missing cnf files), I suggest following the instructions from Stifler6996 in order to get a more up-to-date version of apt-mirror working locally.
Enabling a cronjob to run apt-mirror to your liking will ensure you have the latest updates downloaded from all the repositories you chose. The more repositores you list in mirror.list, the more data will be downloaded.
Configuring Debian based clients is as simply as running a Find and Replace function on /etc/apt/sources.list. You would simply replace all instances of "http://us.archive.ubuntu.com/ubuntu" with your apt mirror's IP address or DNS name and the folder where the updates are saved, such as "http://192.168.2.3/mirror/archive.ubuntu.com/ubuntu."