Difference between revisions of "Mirrors"

From ArchWiki
Jump to: navigation, search
(China: add comments)
(IPv6-ready mirrors: add tsinghua mirror)
Line 201: Line 201:
 
*ftp.nluug.nl (Netherlands)
 
*ftp.nluug.nl (Netherlands)
 
*ftp.surfnet.nl (Netherlands)
 
*ftp.surfnet.nl (Netherlands)
*http://mirror6.bjtu.edu.cn/archlinux (China)
+
*http://mirror6.bjtu.edu.cn/archlinux/ (China)
 +
*http://mirrors.6.tuna.tsinghua.edu.cn/archlinux/ (China)
 
*http://mirrors.inetutils.net/archlinux/ (Malaysia)
 
*http://mirrors.inetutils.net/archlinux/ (Malaysia)
 
*http://mirror.ece.vt.edu/archlinux/ (Virginia, US)
 
*http://mirror.ece.vt.edu/archlinux/ (Virginia, US)

Revision as of 06:37, 14 January 2012

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Summary help replacing me
Updating and managing package mirrors
Related
pacman
reflector

This page is a guide to selecting and configuring your mirrors, and a listing of current available mirrors.

Enabling a specific mirror

To enable mirrors, open /etc/pacman.d/mirrorlist and locate your geographic region. Uncomment mirrors you would like to use.

Note: ftp.archlinux.org is throttled at 50KB/s
Example:
# Any
# Server = ftp://mirrors.kernel.org/archlinux/$repo/os/$arch
Server = http://mirrors.kernel.org/archlinux/$repo/os/$arch

See #Mirror status and #List by speed for tools that help choosing mirrors.

Tip: Uncomment 5 favorite mirrors and place them at the top of the mirrorlist file. That way it's easy to find them and move them around if the first mirror on the list has problems. It also makes merging mirrorlist updates easier.

It is also possible to specify mirrors in /etc/pacman.conf. For the [core] repository, the default setup is:

[core]
Include = /etc/pacman.d/mirrorlist

To use the HostEurope mirror as a default mirror, add it before the Include line:

[core]
Server = ftp://ftp.hosteurope.de/mirror/ftp.archlinux.org/core/os/$arch
Include = /etc/pacman.d/mirrorlist

pacman will now try to connect to this mirror first. Proceed to do the same for [testing], [extra], and [community], if applicable.

Note: If mirrors have been stated directly in pacman.conf, remember to use the same mirror for all repositories. Otherwise packages that are incompatible to each other may be installed, like linux from [core] and an older kernel module from [extra].

Mirror status

Check the status of the Arch mirrors and how updated they are by visiting http://www.archlinux.de/?page=MirrorStatus or http://www.archlinux.org/mirrors/status/.

You can generate an up to date mirrorlist here, automate the process with a script, or install Reflector, a utility that generates a mirrorlist using Mirrorcheck's list; you can also manually check how up-to-date a mirror is by:

  1. picking a server and browsing to "extra/os/";
  2. accessing http://www.archlinux.org/ in another browser tab or window; and
  3. comparing the last-modified date of the i686 directory on the mirror to the [extra] date on the homepage, in the Package Repositories box to the right.

Sorting mirrors

If not using reflector, which has the ability to sort mirrors by both how updated they are and their speed, follow this demonstration of manual mirror sorting.

List by speed

Take full advantage of using the fastest local mirror, which can be determined via the included Bash script, /usr/bin/rankmirrors.

Use cd to switch to the /etc/pacman.d directory:

# cd /etc/pacman.d

Back up the existing /etc/pacman.d/mirrorlist:

# cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup

Edit /etc/pacman.d/mirrorlist.backup and uncomment mirrors for testing with rankmirrors.

Optionally run the following sed line to uncomment every mirror:

# sed '/^#\S/ s|#||' -i /etc/pacman.d/mirrorlist.backup

Finally, rank the mirrors. Operand -n 6 means only output the 6 fastest mirrors:

# rankmirrors -n 6 /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist

Run rankmirrors -h for a list of all the available options.

Force pacman to refresh the package lists
After creating/editing /etc/pacman.d/mirrorlist, (manually or by using rankmirrors) issue the following command:

# pacman -Syy
Tip: Passing two --refresh or -y flags forces pacman to refresh all package lists even if they are considered to be up to date. Issuing pacman -Syy whenever changing to a new mirror is good practice and will avoid possible issues.

Combined listing by speed and status

It is not a good idea to just use the fastest mirrors, since the fastest mirrors might be out of date. The preferred way would be to use #List by speed, then sorting those 6 fastest mirrors by their #Mirror status.

Simply visit either one or both #Mirror status links and sort them by the ones that are more up to date. Move the more up to date mirrors to the top of /etc/pacman.d/mirrorlist and if the mirrors are way out of date simply do not use those; repeat the process leaving out the outdated mirrors. So this ends up with a total of 6 mirrors that are sorted by speed and status, leaving out outdated mirrors.

When having mirror issues the above should be repeated. Or repeat once in a while even if not having mirror problems, to keep /etc/pacman.d/mirrorlist up to date.

Script to automate use of Pacman Mirrorlist Generator

You can use the following shell script to update your mirrors based on the rankings produced by the Pacman Mirrorlist Generator. If you do not live in the United States, you can change the country variable.

updatemirrors.sh
#!/bin/sh

[ "$UID" != 0 ] && su=sudo

country='United+States'
url="http://www.archlinux.org/mirrorlist/?country=$country&protocol=ftp&protocol=http&ip_version=4&use_mirror_status=on"

tmpfile=$(mktemp --suffix=-mirrorlist)

# Get latest mirror list and save to tmpfile
wget -qO- "$url" | sed 's/^#Server/Server/g' > "$tmpfile"

# Backup and replace current mirrorlist file
{ echo "Backing up the original mirrorlist..."
  $su mv -i /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig; } &&
{ echo "Rotating the new list into place..."
  $su mv -i "$tmpfile" /etc/pacman.d/mirrorlist; }
Note: You will need to copy the text above, place it into a file, and run chmod +x on the file. If you are not currently logged in as root, the script will invoke sudo for you when it needs to rotate the new mirrorlist into place.

Using Reflector

Alternatively, you can use Reflector to automatically retrieve the latest mirrorlist from the MirrorStatus page, filter the most up-to-date mirrors, sort them by speed and overwrite the file /etc/pacman.d/mirrorlist.

Official mirrors

The official Arch Linux mirror list is available from the pacman-mirrorlist package. To get an even more up-to-date list of mirrors, use the Pacman Mirror List Generator page on the main site.

In the unlikely scenario that you are without any configured mirrors and pacman-mirrorlist is not installed, run the following command:

# wget -O /etc/pacman.d/mirrorlist https://www.archlinux.org/mirrorlist/all/

Be sure to uncomment a preferred mirror as described above, then:

# pacman -Syy
# pacman -Sf pacman-mirrorlist

If you want your mirror to be added to the official list, file a feature request. In the meantime, add it to the #Unofficial mirrors list at the end of this page.

If you get an error stating that the $arch variable is used but not defined, add the following to your /etc/pacman.conf:

Architecture = x86_64
Note: You can also use the values auto and i686 for the Architecture variable.

Unofficial mirrors

These mirrors are not listed in /etc/pacman.d/mirrorlist.

Global

Bulgaria

China

CHINA TELECOM

CHINA UNICOM

Cernet

Germany

Indonesia

Kazakhstan

Lithuania

Malaysia

New Zealand

Poland

Russia

South Africa

United States

IPv6-ready mirrors

Troubleshooting

Out-of-sync mirrors: corrupted packages/file not found

Issues regarding out-of-sync mirrors pointed out in this news post may have already been sorted out for most users, but in the event that problems of this nature present themselves again, simply try to see if the packages are present in the [testing] repository.

After having synced with pacman -Sy, use this command:

# pacman -Ud $(pacman -Sup | tail -n +2 | sed -e 's,/\(core\|extra\)/,/testing/,' \
                                              -e 's,/\(community\)/,/\1-testing/,')

Doing so could help in any occasion where packages in the mirror have not been synced to [core] or [extra], and are still residing in [testing]. It is perfectly safe to install from [testing] in this case since the packages are being matched by version and release numbers.

In any event, it is best to switch mirrors and sync with pacman -Syy than resorting to an alternate repository. However, all or some of the mirrors may at times be out-of-sync to some degree.

Using all mirrors

To emulate pacman -Su's behavior of going through the entire mirror list, use this script:

~/bin/pacup
#!/bin/bash

# Pacman will not exit on the first error. Comment the line below to
# try from [testing] directly.
pacman -Su "$@" && exit

while read -r pkg; do
  if pacman -Ud "$pkg"; then
    continue
  else
    while read -r mirror; do
      pacman -Ud $(sed "s,.*\(/\(community-\)*testing/os/\(i686\|x86_64\)/\),$mirror\1," <<<"$pkg") &&
      break
    done < <(sed -ne 's,^ *Server *= *\|/$repo/os/\(i686\|x86_64\).*,,gp' \
           </etc/pacman.d/mirrorlist | tail -n +2 )
  fi
done < <(pacman -Sup | tail -n +2 | sed -e 's,/\(core\|extra\)/,/testing/,' \
                                        -e 's,/\(community\)/,/\1-testing/,')

Checking multiple mirrors with paccheck

The paccheck script can be used:

  • to compare pacman sync databases and package desc files to different mirrors,
  • to verify size of packages in pacman cache
  • to optionally compare packages in pacman cache to selected mirror(s).

The script is intended to help to detect compromised mirrors, before the official implementation of package signing. It is destined for those who may want a little more assurance against some possible hacking scenarios of mirror servers.

The Full System Update Procedure is:

  1. Run paccheck as a non-root user. Pacman will be synchronised and the needed packages will be downloaded.
  2. Examine report
  3. If no package mismatch, then run pacman -Su as root to update your system

The script can be found in the AUR: paccheckAUR

See Also

  • [MirUp] -- pacman mirrorlist downloader/checker