What are mirrors?

You pretty much have it down - a mirror holds a duplicate copy of all of the data on the master server. This exists for redundancy and speed. In a broader sense, a mirror is just a copy of some data for the same purposes. But, I'll just focus on mirror servers for the purposes of this answer.

In Canonical's case (and most cases), mirrors are spread all over the globe in strategic locations. This allows servers to handle less load individually and allows everyone to connect to their nearest server.

On the Internet, distance matters. In fact, it matters a lot. A long connection can cause high latency, slower connection speeds, and pretty much all the other classic issues that data has when it needs to travel across an ocean and half a continent. Therefore, we have these distributed mirrors. People connect to their physically nearest one (as it's usually the fastest -- there are some exceptions) for the lowest latency and highest download speed. Other times, users connect to a few mirrors and manually compare the speeds and choose whichever is the fastest. In some rare cases, users might manually override to use a specific mirror that is not their fastest -- usually for reliability or something special about that particular server.

In some cases, companies will host their own internal mirrors of Apt repositories. These exist to hold sensitive intellectual property or only allow employees to use specific versions. Mirrors don't necessarily need to be exact copies of the parent server.


You are asking 2 different questions, or rather you have 2 different tags on your question - repository and mirrors.

Most of the answers have already addressed the why and how behind mirrors. As one more anecdote (and the plural of anecdote is data!) I run a mirror of Mint, Ubuntu, and Debian simply to provide much quicker access in the computer lab I teach in. 20 folks all getting updates at once, or doing netinstalls, or ... goes much quicker at gigabit speed vs. the 5mb internet that feeds the building.

But repositories....

The ideas behind the repos for Ubuntu actually all start with Debian (which Ubuntu is heavily based on) and Debian's package management system which includes the apt utilities in various versions and incarnations (apt, apt-get, aptitude, etc). With the Debian package management system, a standard base system is told where to get software packages and updates from. This could be any number of sources - hard drives, cd-rom/dvd, network share, or via network protocol like http(s), ftp, and rsync. Part of this information includes what software is available, and what packages depend on what other packages all the way down to the base system.

This allows you to run a command like apt-get install task-mate-desktop and the package management system says "well, you need to have this version of libraryA installed, and that version of libraryB installed and foo version 3.14 and ... " and since it knows what you have installed, it knows what it needs to retrieve from the source (quite probably one of those mirrors you were asking about), and it goes gets what it needs and installs it all. Note that the GUI software management tools in Ubuntu et al. are all just front ends to apt and dpkg.

Now, the Debian/Ubuntu/Mint/etc. folks aren't the only ones doing stuff like this. The BSD releases and the ports collection as well as the pkg tool, yum for Redhat and similar distributions, the portage collection from Gentoo, and others.


As you find it out yourself, a mirror is another server which mirrors/clones everything from the main server.

There are a lot of advantages behind using mirrors, things like:

Short answer: redundancy, more reliability, backup, fault tolerance, money, performance, speed and many more.

  1. You can choose a mirror which is located in your country or is closer to you or in any other way you have a more reliable and faster access to that.

  2. We have redundancy. Redundancy simply means having more than of on (Copy/Backup) of a resource (Hardware or software) which brings more reliability. When I have access to thousands of mirrors there is a really low chance that I miss something or I lose my access to repositories.

  3. By redundancy it helps me achieve fault tolerance, it means that in any case of accident my services are up and available to my users.

  4. It helps to decrease the costs of servers. If we all use same mirror, it should have a huge resources and bandwidths, so the owner should pay a lot of money for that.

  5. It help us achieve better performance by not a server being used by millions of people.

  6. We can mirror it on our local network and hundreds of machines will work with that repository without the need of going to the Internet.

etc.