Notes:please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Local Mirror (简体中文)#)

注意： 95%的用户不需要这么做。同步core和extra上的所有软件包会带来许多你所不需要的东西。Only follow these instructions if you are running a very large site of Arch machines or want to create an official mirror. Perhaps using a Network Shared Pacman Cache would serve you better.

NOTE: Due to traffic issues rsyncing from rsync.archlinux.org is allowed only for official mirrors. If you want to create an official mirror - write to the mailing list about this and entries in /etc/pacman.d/* will be added and your IP address will be allowed.

If you want to get a full mirror for personal use only, you may rsync from rsync://distro.ibiblio.org/distros/archlinux/

This document describes how to create a mirror on your local machine of all the packages and iso files on the Arch mirrors, how to update it using cron, how to serve the mirror with vsftpd, and how to set up pacman to use the local mirror.

This setup will offer a very secure FTP server, tailored specifically for our needs. Note that this setup does not require a password, and should not be used in a publicly accessible network (unless that's what you want). Password protecting the FTP and still allowing it to work with pacman is beyond the scope of this document.

If you are going to connect to this machine from the outside, you will need to add the following line to /etc/hosts.allow:

vsftpd : ALL : ALL

Note that this will allow anyone to download from the mirror. If you want to control downloads more tightly, and don't know how to do so, see linux.about.com on the subject.

Let's make sure vsftpd starts:

sudo /etc/rc.d/vsftpd start

If vsftpd does not start, check that the options are set correctly in your /etc/vsftpd.conf file.

Enabling the mirror for pacman

Now let's edit /etc/pacman.d/* files to use our shiny new mirror. Add the following line to the top of /etc/pacman.d/core, at the top of the Servers list:

Repeat this same process for the other repositories you are mirroring. Non-local machines will need to use an IP address to access the repository. Also make sure that the machine serving the mirror has a static IP address.

Synchronizing for the first time

Here comes the pain! Run the following command to start the sync:

sudo -u mirror ./scripts/mirrorsync.sh

This won't give you any kind of output, but you probably want some. You can use something like this (correct for the name of log file) to monitor the sync progress:

tail -f logs/pkgsync_20070203-9.log

This process will usually take a few hours, depending on the speed of your internet connection and how many repositories you are mirroring. After the first sync, only new packages will be sync'ed, so it will be m