Setting up an apt repository mirror

Setting up an apt repository mirror

Thank you for considering setting up a mirror of our apt repository. Once you get done, please remember to contact us at one of the community links at the bottom of the page and let us know a new mirror exists. That way we can help users switch to your mirror if it performs faster for them.

In this tutorial, we assume you already set up a web server and have an empty folder showing when you visit the URL for that web server. You need to make sure users can download files, see the directory structure, and see how big files and folders are. SSL support is encouraged but not mandatory.

Step 1: Set up Crontab

Get access to a terminal on your server, either through a direct connection, or SSH.

Once connected, run the following command:

crontab -e

If you have never used the crontab command before, it may prompt you to select which text editor to use. Use whichever is your favorite.

At the bottom of the file, on it’s own line, put the following:

0 0 * * * rsync -az rsync:// <path-to-dest>

Replace <path-to-dest> with the path to the folder you want the apt repository in.


Step 2: Let Her Rip!

Just save the file and let it go!

It may take a few hours for it to sync. It will download changes to the apt repository once a day, at midnight. This should keep you reasonably up-to-date, and get fixes sent out reasonably fast. Also keep in mind that the first sync takes the most time due to all the files it needs to download. It shouldn’t take too much time, since the downloads are compressed, but you will still need to be patient with it.


Thanks again for setting up an mirror of our apt repository! And again, don’t forget to let us know about it!