This may sound trivial, but I haven't found a solution anywhere yet. Is there a way to backup or clone an apt repository such that I get a clone that (1) contains all current packages and (2) keeps all old packages.

I know that there is apt-mirror and apt-clone but the very brief documentation doesn't say anything if old package versions are kept. Unfortunately our product depends on packages from a repository where only the newest version is kept. I would like to maintain a local repository that contains the current and all old package versions. Is that possible and how?

2 Answers 2


Note to myself and others: The solution I use now is aptly.

From their website:

aptly is a swiss army knife for Debian repository management: it allows to mirror remote repositories, manage local package repositories, take snapshots, pull new versions of packages along with dependencies, publish snapshots as Debian repositories.

So far my experiences with aptly have been quite good.

  • 1
    Although it looks like it has a few shortfalls, aptly is still excellent compared to any other solution. I was able to mirror a repository from PPA and then transform that in a "local repo" and add a package to it and finally generate a snapshot of that as my "stable" version. It's a bit of a learning curve, but in comparison to what we have from Debian, it was dead easy with aptly! Sep 2, 2018 at 2:34
  • As in 2022, I believe it is still incapable of snapshotting a local installation, it can only snapshot remote repository
    – tribbloid
    Jan 9 at 0:18

You could use debmirror in debmarshal mode which seems to keep snapshots of release of packages allowing you to rollback if necessary. Seems simple enough according to the wiki.

If that's too complex, mirrors normally don't delete the packages when they are updated, so using a browser you should able to redownload the packages, if necessary. Also, apt keeps a cache of all downloaded packages in /var/lib/apt/archives which is not cleaned unless you use clean.

  • Thanks for the pointer to debmirror. I use aptly now though. In my case I need to keep Ubuntu packages and the official Ubuntu repositories only hold the latest version.
    – Stefan
    Aug 17, 2014 at 13:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .