Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is a local mirror of a debian apt repository? any simple explanation. Is it the same as ubuntu repository? what is the best way to create one? and is it mandatory to keep the same folder hierarchy as the original repository? or there is a way to configure that change?

share|improve this question
possible duplicate of Is it possible to mirror the apt repositories? – Web-E Dec 30 '12 at 11:32
@Web-E I don't agree with that duplicate. That question is about caching and saving bandwidth. This question is about what a local mirror is. – gertvdijk Dec 30 '12 at 12:57

when not to mirror

Before even bothering to start mirroring a whole repository, you should be aware of this:

  • In case you're just trying to save bandwidth with multiple similar clients. Instead:

    Best way to cache apt downloads on a LAN?

  • In case you are setting up a public mirror, but the software license restricts you to do so. Not all third party software allows you to redistribute their software, such as Oracle Java. (not the best example, as they don't even offer a Debian repository)

  • If you're just interested in a small selection of the packages. Instead, just download the .deb files and then follow:

    How to set up a Debian Repository?

the what

any simple explanation.

I hope you mean simple as in simple wording, rather than short/compact.

What is a local mirror of a debian apt repository?

Let's zoom out a bit, first. Debian and Ubuntu are very common Operating Systems, specifically, Ubuntu is derived from a Debian base. One of the key features of Debian and therefore also Ubuntu, is the package management. Repositories are a set of packages published in a certain way that the package management can easily understand the package list and verify the integrity of all of it. Repositories are copied all over the world for more efficient use of bandwidth as well as to have a higher availability. This continuous copying (or synchronisation) is also called mirroring.

Now, zooming back in on your question. You can do this mirroring operation yourself as well. This will pull in tens of Gigabytes of data just for the main repositories, but once copied, you'll have them local, at LAN speed! This is useful for deploying a big amount of machines and you don't want to rely on the internet for some reason (bandwidth, availability, etc.). You can mirror from a local mirror near you or pick one that has a lower delay.

Is it the same as ubuntu repository?

If one refers to a Debian APT repository, this is ambiguous for either a repository for...

  • the Debian OS, containing all Debian packages.
  • the use with APT, possibly providing packages for other APT-based distributions.

The format of the repositories is the same, speaking in terms of simple ones. Debian has some differences for differential updating package lists for example, but it doesn't mean it's incompatible.

is it mandatory to keep the same folder hierarchy as the original repository?

If you do a simple mirror, you can pick another sublevel, e.g. http://host.domain.tld/my-mirrors/ubuntu-archive/ubuntu, but you'll have to adhere to the format of the repository. You can't just shuffle around .debs there, as there are cross-references in there.

share|improve this answer
Thanks @gertvdijk, very useful, actualy I don't want to mirror the Debian/Ubuntu official repository, I want to mirror cloudera CDH4 and Cloudera manager 4 repos to setup a cluster of 30 node. Both repos contain packages from all versions of the tools, and I find troubles mirroring only the parts that I really need (last version), every package have some dependencies but I can't find them, is the mirroring tool reponsible about finding and downloading this dependencies? – Nafaa Boutefer Jan 8 '13 at 18:01
@NafaaBoutefer Ask another question with these specific details, as I've answered the what, not the how. I'm happy to answer it if you still feel it's applicable still after reading the updates to this answer. – gertvdijk Jan 8 '13 at 18:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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