Infrastructure/Mirroring/ProxyMirror

A proxy mirror is a local mirror that does not sync the entire Fedora install tree. Instead, it serves files through a reverse caching proxy that connects to a public Fedora mirror and downloads files as needed, then serves them from the local machine once they have been cached. This is useful in several circumstances:


 * 1) You don't have the disk space or bandwidth to set up a full mirror.
 * 2) You are testing functionality of a local mirror environment before fully mirroring the Fedora tree.
 * 3) You are setting up multiple targeted installations of Fedora (such as Web servers) that will be installing only a small subset of Fedora packages.

= Installing Squid =

First, install the  package. Then create a new  with the following:

http_port 3128 accel defaultsite=$MIRROR_HOSTNAME cache_peer $MIRROR_HOSTNAME parent 80 0 no-query originserver http_access allow all

cache_dir ufs /var/spool/squid 1024 16 256 maximum_object_size 524288 KB range_offset_limit -1

access_log /var/log/squid/access.log

Replace  with the hostname of your preferred Fedora mirror, such as.

Once your configuration is saved, start Squid with.

= Installing Apache =

Install the  package. Then add the following to :

ProxyPass /fedora/ http://localhost:3128/fedora

You will need to ensure that the path portion of the URL matches the path of the mirror you are proxying to. So if your chosen mirror keeps its Fedora tree in /pub/fedora, adjust the configuration appropriately:

ProxyPass /fedora/ http://localhost:3128/pub/fedora

Once your configuration is saved, start Apache with.

= SELinux =

If you have SELinux enabled on your mirror server (and don't wish to disable it), you will need to grant Apache access to the Squid port. You can do this with the command.

= Using Your Proxy Mirror =

To test your proxy mirror, point a Web browser to http://proxymirror/fedora/ (where proxymirror is the name or IP of your proxy mirror server), and you should see the directory index from your selected Fedora mirror. You can now point local clients to the appropriate subdirectory, such as http://proxymirror/fedora/releases/9/Fedora/i386/os. Squid will download files as necessary, and serve local cached copies when available.

= Converting To A Full Mirror =

If, at a later point, you decide to create a full local Fedora mirror, simply remove the  line from , and either place your local mirror in   or alias another directory to /fedora. Your clients do not need to be reconfigured. You can also remove Squid and the SELinux policy.