Becoming A CTAN Mirror

Having a .. CTAN mirror will change your life. – M Doob

You can help out the TeX community by running a mirror of the Comprehensive TeX Archive Network. This page contains directions on how to become an official CTAN mirror. They should suffice if you run Linux and probably also if you run Macintosh OS X. (If you write up instructions for a Windows system, please, let us know.)

CTAN has three core sites, which install new packages and package updates. There are also a fair number of sites that participate as mirrors, who copy our holdings every night and then makes those files available to others in the TeX community. At the core sites we redirect requests for file downloads to our mirrors, thereby reducing the load on the primary three sites. We do this by sending users to web addresses beginning with mirror.ctan.org, which sends the user to a randomly-selected official mirror in their region.

If you decide to become a mirror then once you have it set up, it mostly runs itself. So this is a low-impact way to help out. You need a permanent IP address and at least 20 GB of hard drive space free (30 GB leaves room to grow). The traffic is not too much, but if we have enough mirrors then of course each of them helping a little results in an overall help that is big.

These are the steps to setting up a mirror. More on each is in a section below.

Simplicity

The two most popular way to offer the files to your visitors are over HTTP and over FTP. To keep the discussion straightforward, the examples below assume that you keep the archive in the /var/ftp/pub/tex-archive directory.

If you will offer the materials over HTTP then you must have a web server. We use Apache. Setting up the web server is beyond this document's scope. However, here are a few suggestions to consider.

To offer materials over FTP, you must have an FTP demon running. We use ProFTPD but there are many others. Setting up the demon is beyond our scope, but if your documentation does not cover how to allow anonymous access then just get new server software.

Synchronicity

To keep your materials up to date run rsync. This program does the transfers efficently, saving both us and you a great deal of network traffic.

You must mirror from one of these three primary CTAN nodes. The example below uses the first but you should pick the one nearest to you.

Site Location
rsync://rsync.cam.ctan.org/CTAN England
rsync://rsync.dante.ctan.org/CTAN Germany
rsync://rsync.tug.ctan.org/CTAN Northeast USA

The command below will get everything on CTAN and put it on your hard drive. Use it the first time you get from the archive, and also for later updates. Note that the first time you run it the command can take quite a long time — hours, perhaps, depending on the connection speed.

  rsync -av --delete rsync://rsync.cam.ctan.org/CTAN /var/ftp/pub/tex-archive

A summary of what the options mean:

Before you run the above command, you can check that you will get the result that you expect by using the -n option, as in rsync -avn --delete ... This will say what would be done without doing it.

Periodicity

You must run the above command every day. At the command line ask for crontab -e and in the editor that appears enter a line like this.

  31 2 * * * rsync -a --delete rsync://rsync.cam.ctan.org/CTAN /var/ftp/pub/tex-archive
The data at the start of that line means that your system will run the rsync command

Please change these numbers when you set yours up, so that not everyone in the world hits us at the same instant. Pick a time that is in the middle of the night at the location of the archive that you are mirroring.

Authenticity

When you have the files, and the cron job working, and have checked that you are offering public access, sign up to become an official mirror.

Note: we monitor mirrors to check that they are up to date. If your mirror falls behind then mirror.ctan.org will not redirect to it, and we shall have to remove it from the official list.