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 one core site, which installs 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 sites. We do this by sending users to web addresses beginning
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 permanent Internet connectivity and at least 42 GB of hard drive space free (50 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.
- Giving visitors access to files means running either a web or FTP demon, or both.
- Get the files to hold from us by running rsync.
- Update those files every day. This means running rsync as a cron job.
- Sign up to be an official mirror.
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
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.
One way to make the archive available is by putting a soft link inside
your document root. With the default Apache setup, this
ln -s /var/ftp/pub/tex-archive /var/www/html/tex-archivemakes
http://www.example.com/tex-archivegive the page showing the top level directory for the archive.
You want to keep files in the archive that happen to be named
index.htmlfrom being served by your Apache as the index of that directory's page. Put something like this in your configuration file.
<Directory /> # prevent web visitors from seeing outside the web tree Order Deny,Allow Deny from all </Directory> <Directory /var/www/html> # allow web visitors to see in the web tree Order Allow,Deny Allow from all Options +FollowSymLinks </Directory> <Directory /var/www/html/tex-archive> # soft link to CTAN tree Order Allow,Deny Allow from all Options -ExecCGI, +FollowSymLinks, -Includes, -IncludesNOEXEC, +Indexes DirectoryIndex disabled </Directory>
To offer materials over FTP, you must have an FTP demon running. We use vsftpd 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.
To keep your materials up to date run rsync. This program does the transfers efficiently, saving both us and you a great deal of network traffic.
You must mirror from the primary CTAN node.
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.dante.ctan.org/CTAN /var/ftp/pub/tex-archive
A summary of what the options mean:
- -a puts you in archive mode so that you look through directories recursively, preserve timestamps, etc.
- -v is for verbose output that reports the files downloaded and deleted
- --delete will delete files that used to be on CTAN but are no longer there.
Before you run the above command, you can check that you will get the
result that you expect by using the
-n option, as
rsync -avn --delete ... This will say what would be done
without doing it.
You must run the above command every day. At the command line ask
crontab -e and in the editor that appears enter a line
31 2 * * * rsync -a --delete rsync://rsync.dante.ctan.org/CTAN /var/ftp/pub/tex-archiveThe data at the start of that line means that your system will run the
- at 31 minutes past the hour
- of the 2nd hour of the day
- on every day of the month
- and during every month of the year
- and every day of the week (that is, Sunday thru Saturday).
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.
This document is based on a presentation by M. Doob at the 2001 meeting of the TeX Users Group. Written 2001-Sep-11 by J. Hefferon, updated 2009-July-02. Updated June 2017 Gerd Neugebauer.
Once you have gotten the files, and the cron job is working, and you have checked that you are offering public access, then you can become an official mirror by filling out the form below.
You will be enrolled in the low-traffic mailing list for our mirror maintainers.
monitor mirrors to check that they are up
to date. If your mirror falls behind then
will not redirect to it, and we shall have to remove it from the