Difference between revisions of "Mirrors (简体中文)"

From ArchWiki
Jump to: navigation, search
(启用您喜爱的镜像)
(Update from English version)
Line 3: Line 3:
 
[[Category:Package management (简体中文)]]
 
[[Category:Package management (简体中文)]]
 
{{i18n|Mirrors}}
 
{{i18n|Mirrors}}
 +
[[fr:Miroirs]]
 +
{{Translateme}}
 +
 +
{{Article summary start|Summary}}
 +
{{Article summary text|Updating and managing package mirrors}}
 +
{{Article summary heading|Related}}
 +
{{Article summary wiki|pacman}}
 +
{{Article summary wiki|reflector}}
 +
{{Article summary end}}
 +
 
本页面说明如何选择和配置镜像,以及列出可用的镜像。
 
本页面说明如何选择和配置镜像,以及列出可用的镜像。
  
Line 31: Line 41:
 
{{Note|If mirrors have been stated directly in {{ic|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]''.}}
 
{{Note|If mirrors have been stated directly in {{ic|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]''.}}
  
== 官方镜像 ==
+
==镜像状态==
 +
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 [http://www.archlinux.org/mirrorlist/ here], automate the process with a [[#Script to automate use of Pacman Mirrorlist Generator|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:
 +
#picking a server and browsing to "extra/os/";
 +
#accessing http://www.archlinux.org/ in another browser tab or window; and
 +
#comparing the last-modified date of the {{ic|i686}} directory on the mirror to the ''[extra]'' date on the homepage, in the ''Package Repositories'' box to the right.
  
This is a list of all known Arch Linux mirrors, that's more up to date than the [http://www.archlinux.org/download/ official download page] or the [http://cvs.archlinux.org/cgi-bin/viewcvs.cgi/base/pacman/ files in <tt>/etc/pacman.d/</tt>]. If you know of a mirror that is not listed, please add it. Mirrors which are no longer updated or have been unavailable for a long time can be deleted.
+
==镜像排序==
 +
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.
  
Here is a hint to check just how up-to-date your chosen mirror is:
+
===按速度排序===
# pick a server and browse to "extra/os/"
+
Take full advantage of using the fastest local mirror, which can be determined via the included Bash script, {{ic|/usr/bin/rankmirrors}}.
# load [http://www.archlinux.org/ archlinux.org] in another tab or window
 
# compare 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.
 
<br>
 
Many sites also provide http service, but keep in mind that pacman relies on ftp to determine if a repository got updated. With http it fetches the repository database each time you run <tt>pacman -Sy</tt>, even if it didn't change since the last run.
 
  
[http://users.archlinux.de/~gerbra/mirrorcheck.html This website] provides updates on the current status of the Arch mirrors and how up to date they are.
+
Use {{Ic|cd}} to switch to the {{ic|/etc/pacman.d}} directory:
 +
# cd /etc/pacman.d
  
'''Attention: Do not add new mirrors to the list below. If you want your mirror to be added to official list - file a feature request. In the meantime add it to the "Unofficial mirrors" list at the end of this page.'''
+
Back up the existing {{ic|/etc/pacman.d/mirrorlist}}:
 +
# cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
  
=== 澳大利亚 ===
+
Edit {{ic|/etc/pacman.d/mirrorlist.backup}} and uncomment mirrors for testing with {{ic|rankmirrors}}.
*ftp://mirror.pacific.net.au/linux/archlinux/ <sub>[http://mirror.pacific.net.au/linux/archlinux/ http]</sub> <sub>[rsync://mirror.pacific.net.au/linux/archlinux/]</sub>
 
*ftp://mirror.aarnet.edu.au/pub/archlinux/ <sub>[http://mirror.aarnet.edu.au/pub/archlinux/ http]</sub> <sub>[rsync://mirror.aarnet.au/pub/archlinux/]</sub>
 
  
=== 奥地利 ===
+
Optionally run the following {{Ic|sed}} line to uncomment every mirror:
*ftp://gd.tuwien.ac.at/opsys/linux/archlinux/ <sub>[http://gd.tuwien.ac.at/opsys/linux/archlinux/ http]</sub>
+
# sed '/^#\S/ s|#||' -i /etc/pacman.d/mirrorlist.backup
  
=== 比利时 ===
+
Finally, rank the mirrors. Operand {{Ic|-n 6}} means only output the 6 fastest mirrors:
*ftp://ftp.belnet.be/mirror/archlinux.org/ <sub>[http://ftp.belnet.be/mirror/archlinux.org/ http]</sub>
+
# rankmirrors -n 6 /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist
  
=== 巴西 ===
+
Run {{Ic|rankmirrors -h}} for a list of all the available options.
*ftp://archlinux.c3sl.ufpr.br/archlinux/ <sub>[http://archlinux.c3sl.ufpr.br/ http]</sub>
 
*ftp://ftp.las.ic.unicamp.br/pub/archlinux <sub>[http://www.las.ic.unicamp.br/pub/archlinux http]</sub> <sub>[rsync://rsync.las.ic.unicamp.br/archlinux rsync]</sub>
 
  
=== 加拿大 ===
+
'''Force pacman to refresh the package lists'''<br>
*ftp://mirror.csclub.uwaterloo.ca/archlinux/ <sub>[http://mirror.csclub.uwaterloo.ca/archlinux/ http]</sub> <sub>[rsync://mirror.csclub.uwaterloo.ca/archlinux/ rsync]</sub>
+
After creating/editing {{ic|/etc/pacman.d/mirrorlist}}, (manually or by using {{Ic|rankmirrors}}) issue the following command:
 +
# pacman -Syy
  
=== 捷克 ===
+
{{Tip|Passing two {{Ic|--refresh}} or {{Ic|-y}} flags forces pacman to refresh all package lists even if they are considered to be up to date. Issuing {{Ic|pacman -Syy}} ''whenever changing to a new mirror'' is good practice and will avoid possible issues.}}
*ftp://ftp.sh.cvut.cz/MIRRORS/arch/ <sub>[http://ftp.sh.cvut.cz/MIRRORS/arch/ http]</sub>
 
  
=== 爱沙尼亚 ===
+
===按速度和状态排序===
*ftp://ftp.estpak.ee/pub/archlinux/ <sub>[http://ftp.estpak.ee/pub/archlinux/ http]</sub>
+
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 [[#按速度排序]], then sorting those 6 fastest mirrors by their [[#镜像状态]].  
  
=== 法国 ===
+
Simply visit either one or both [[#镜像状态]] links and sort them by the ones that are more up to date. Move the more up to date mirrors to the top of {{ic|/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.  
*ftp://distrib-coffee.ipsl.jussieu.fr/pub/linux/archlinux/ <sub>[http://distrib-coffee.ipsl.jussieu.fr/pub/linux/archlinux/ http]</sub> <sub>[rsync://distrib-coffee.ipsl.jussieu.fr/pub/linux/archlinux/ rsync]</sub>
 
*ftp://mir1.archlinuxfr.org/archlinux <sub>[http://mir1.archlinuxfr.org/archlinux http]</sub> <sub>[rsync://mir1.archlinuxfr.org/archlinux rsync]</sub>
 
*ftp://mir2.archlinuxfr.org/archlinux <sub>[http://mir2.archlinuxfr.org/archlinux http]</sub> <sub>[rsync://mir2.archlinuxfr.org/archlinux rsync]</sub>
 
*http://mir.archlinux.fr/
 
*ftp://ftp.free.fr/mirrors/ftp.archlinux.org/
 
*ftp://ftp.rez-gif.supelec.fr/Linux/archlinux/
 
=== 德国 ===
 
*ftp://ftp5.gwdg.de/pub/linux/archlinux/ <sub>[http://ftp5.gwdg.de/pub/linux/archlinux/ http]</sub> <sub>[rsync://ftp5.gwdg.de/pub/linux/archlinux/ rsync]</sub>
 
*ftp://ftp.hosteurope.de/mirror/ftp.archlinux.org/ <sub>[http://ftp.hosteurope.de/mirror/ftp.archlinux.org/ http]</sub>
 
*ftp://ftp.tu-chemnitz.de/pub/linux/archlinux/ <sub>[http://ftp.tu-chemnitz.de/pub/linux/archlinux/ http]</sub>
 
*ftp://ftp.archlinuxppc.org/i686/
 
*ftp://ftp.uni-kl.de/pub/linux/archlinux/ <sub>[http://ftp.uni-kl.de/pub/linux/archlinux/ http]</sub> <sub>[rsync: ftp.uni-kl.de::pub/linux/archlinux/  rsync]</sub>
 
*ftp://ftp.uni-bayreuth.de/pub/linux/archlinux <sub>[http://ftp.uni-bayreuth.de/linux/archlinux http]</sub> <sub>[rsync://rsync.uni-bayreuth.de/archlinux/ rsync]</sub>
 
  
=== 英国 ===
+
When having mirror issues the above should be repeated. Or repeat once in a while even if not having mirror problems, to keep {{ic|/etc/pacman.d/mirrorlist}} up to date.
*http://www.mirrorservice.org/sites/ftp.archlinux.org/
 
*ftp://mirrors.uk2.net/pub/archlinux/ <sub>[http://archlinux.mirrors.uk2.net/ http]</sub>
 
  
=== 希腊 ===
+
===Script to automate use of Pacman Mirrorlist Generator===
*ftp://ftp.ntua.gr/pub/linux/archlinux/ <sub>[http://ftp.ntua.gr/pub/linux/archlinux/ http]</sub>
+
You can use the following shell script to update your mirrors based on the rankings produced by the [http://www.archlinux.org/mirrorlist/ Pacman Mirrorlist Generator]. If you do not live in the United States, you can change the country variable.
  
=== 匈牙利 ===
+
{{hc|updatemirrors.sh|2=<nowiki>#!/bin/sh
*ftp://ftp.mfa.kfki.hu/pub/mirrors/ftp.archlinux.org/
 
  
=== 爱尔兰 ===
+
[ "$UID" != 0 ] && su=sudo
*ftp://ftp.heanet.ie/mirrors/ftp.archlinux.org/ <sub>[http://ftp.heanet.ie/mirrors/ftp.archlinux.org/ http]</sub>
 
  
=== 以色列 ===
+
country='United+States'
*http://mirror.isoc.org.il/pub/archlinux/
+
url="http://www.archlinux.org/mirrorlist/?country=$country&protocol=ftp&protocol=http&ip_version=4&use_mirror_status=on"
  
=== 意大利 ===
+
tmpfile=$(mktemp --suffix=-mirrorlist)
*ftp://mi.mirror.garr.it/mirrors/archlinux/ <sub>[http://mi.mirror.garr.it/mirrors/archlinux/ http]</sub>
 
  
=== 荷兰 ===
+
# Get latest mirror list and save to tmpfile
*ftp://ftp.nluug.nl/pub/metalab/distributions/archlinux/ <sub>[http://ftp.nluug.nl/pub/metalab/distributions/archlinux/ http]</sub>
+
wget -qO- "$url" | sed 's/^#Server/Server/g' > "$tmpfile"
*ftp://ftp.surfnet.nl/pub/os/Linux/distr/archlinux/ <sub>[http://ftp.surfnet.nl/pub/os/Linux/distr/archlinux/ http]</sub>
 
  
=== 挪威 ===
+
# Backup and replace current mirrorlist file
*http://arch.likbilen.com/ (rsync 可用)
+
{ 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; }</nowiki>}}
  
=== 波兰 ===
+
{{Note|You will need to copy the text above, place it into a file, and run {{Ic|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.}}
*ftp://mirror.icis.pcz.pl/archlinux/
 
*ftp://ftp.piotrkosoft.net/pub/mirrors/ftp.archlinux.org/ [http://piotrkosoft.net/pub/mirrors/ftp.archlinux.org/ http]
 
*http://unix.net.pl/archlinux.org/
 
  
=== 葡萄牙 ===
+
===使用 Reflector===
*ftp://cesium.di.uminho.pt/pub/archlinux/ <sub>[http://cesium.di.uminho.pt/pub/archlinux/ http]</sub>
 
  
=== 罗马尼亚 ===
+
Alternatively, you can use [[Reflector]] to automatically retrieve the latest mirrorlist from the [http://www.archlinux.org/mirrors/status/ MirrorStatus] page, filter the most up-to-date mirrors, sort them by speed and overwrite the file {{ic|/etc/pacman.d/mirrorlist}}.
*ftp://ftp.iasi.roedu.net/mirrors/archlinux.org/ <sub>[http://ftp.iasi.roedu.net/mirrors/archlinux.org/ http]</sub>
 
  
=== 俄罗斯 ===
+
==官方镜像==
*ftp://mirror.yandex.ru/archlinux/ <sub>[http://mirror.yandex.ru/archlinux/ http]</sub> (rsync 可用)
+
The official Arch Linux mirror list is available from the {{pkg|pacman-mirrorlist}} package. To get an even more up-to-date list of mirrors, use the [https://www.archlinux.org/mirrorlist/ Pacman Mirror List Generator] page on the main site.
*http://archlinux.freeside.ru/
 
  
=== 瑞典 ===
+
In the unlikely scenario that you are without any configured mirrors and {{Ic|pacman-mirrorlist}} is not installed, run the following command:
*ftp://ftp.ds.hj.se/pub/os/linux/archlinux/ <sub>[http://ftp.ds.hj.se/pub/os/linux/archlinux/ http]</sub>
+
# wget -O /etc/pacman.d/mirrorlist <nowiki>https://www.archlinux.org/mirrorlist/all/</nowiki>
*ftp://ftp.gigabit.nu/ <sub>[http://ftp.gigabit.nu/ http]</sub>
 
  
=== 瑞士 ===
+
Be sure to uncomment a preferred mirror as described above, then:
*ftp://archlinux.puzzle.ch/ <sub>[http://archlinux.puzzle.ch/ http]</sub>
+
# 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.
*http://server.elsistech.com/archlinux/
 
  
=== 乌克兰 ===
+
If you get an error stating that the {{ic|$arch}} variable is used but not defined, add the following to your {{ic|/etc/pacman.conf}}:
*ftp://hell.org.ua/archlinux/ (rsync 可用)
+
Architecture = x86_64
*ftp://ftp.linux.kiev.ua/pub/Linux/ArchLinux/ <sub>[http://ftp.linux.kiev.ua/pub/Linux/ArchLinux/ http]</sub>
 
  
=== 美国 ===
+
{{Note|You can also use the values {{Ic|auto}} and {{Ic|i686}} for the {{ic|Architecture}} variable.}}
*ftp://ftp.archlinux.org/
 
*ftp://locke.suu.edu/linux/dist/archlinux/
 
*http://archlinux.unixheads.org/
 
*ftp://mirrors.easynews.com/linux/archlinux/ <sub>[http://mirrors.easynews.com/linux/archlinux/ http]</sub>
 
*ftp://ftp.gtlib.gatech.edu/pub/linux/distributions/archlinux/ [http://www.gtlib.gatech.edu/pub/linux/distributions/archlinux/ http]
 
*ftp://mirror.cs.vt.edu/pub/ArchLinux/ <sub>[http://mirror.cs.vt.edu/pub/ArchLinux/ http]</sub> (rsync 可用)
 
*ftp://ibiblio.org/pub/linux/distributions/archlinux/ <sub>[http://distro.ibiblio.org/pub/linux/distributions/archlinux/ http]</sub>
 
*http://holmes.umflint.edu/archlinux/
 
*http://mirror.neotuli.net/
 
*ftp://mirror.rit.edu/archlinux/ <sub>[http://mirror.rit.edu/archlinux/ http]</sub> <sub>[rsync://mirror.rit.edu/archlinux/ rsync]</sub>
 
* http://schlunix.org/archlinux/
 
* http://mirror.umoss.org/archlinux/ <sub>[rsync://mirror.umoss.org/archlinux/ rsync]</sub>
 
  
=== 越南 ===
+
==非官方镜像==
*ftp://ftp.indochinalinux.com/archlinux/ (DNS 经常出问题,IP 是 202.78.230.5)
+
These mirrors are ''not'' listed in {{ic|/etc/pacman.d/mirrorlist}}.
  
=== 台湾 ===
+
===全球===
* ftp://ftp.tku.edu.tw/Linux/ArchLinux/
+
* http://sourceforge.net/projects/archlinux/files/ - ''Does not have recent ISO releases. Use it only if for getting older ISOs.''
* http://ftp.tku.edu.tw/Linux/ArchLinux/
 
* ftp://ftp.mirror.tw/pub/ArchLinux/
 
* http://ftp.mirror.tw/pub/ArchLinux/
 
  
== 中国镜像 ==
+
===保加利亚===
# 电信
+
*http://mirror.telepoint.bg/archlinux/  
#* http://mirrors.163.com/archlinux/ (隔天更新,速度很快)
+
*ftp://mirror.telepoint.bg/archlinux/
#* http://mirror.lupaworld.com/archlinux/
 
  
# 网通
+
===中国===
#* ftp://xde.gooth.cn/
+
# CHINA TELECOM
#* http://mirrors.sohu.com/archlinux/
+
*http://mirror.lupaworld.com/archlinux/
  
# 教育网
+
# CHINA UNICOM
#* http://ftp.sjtu.edu.cn/pub/mirror2/www.archlinux.org/
+
*http://mirrors.sohu.com/archlinux/
#* http://mirror.bjtu.edu.cn/archlinux
 
#* http://mirror6.bjtu.edu.cn/archlinux (IPv6, 北京交通大学)
 
  
== 非官方镜像 ==
+
===德国===
'''These mirrors are not listed in <code>/etc/pacman.d/mirrorlist</code>.'''
+
*http://ftp.uni-erlangen.de/mirrors/archlinux/
 +
*ftp://ftp.uni-erlangen.de/mirrors/archlinux/
 +
*http://ftp.u-tx.net/archlinux/
 +
*ftp://ftp.u-tx.net/archlinux/
  
# 全球
+
===印度尼西亚===
*http://prdownloads.sourceforge.net/archlinux/ ( Doesn't have recent ISO releases. Use it only if for some reason you want to use an older ISO. )
+
*http://mirror.kavalinux.com/archlinux/ - ''only from Indonesia''
 +
*http://kambing.ui.ac.id/archlinux/
 +
*http://repo.ukdw.ac.id/archlinux/
  
# 澳大利亚
+
===立陶宛===
*ftp://mirror.internode.on.net/pub/archlinux/
+
*http://edacval.homelinux.org/mirrors/archlinux/ - ''Only from LT, without ISO''
<sub>[http://mirror.internode.on.net/pub/archlinux/ http]</sub>
 
  
# 马来西亚
+
===马来西亚===
*http://oss.mmu.edu.my/distro/arch (ISOs only)
 
 
*http://mirror.oscc.org.my/archlinux/
 
*http://mirror.oscc.org.my/archlinux/
 +
*http://mirrors.inetutils.net/archlinux/ - ''ISO and Core''
 +
 +
===新西兰===
 +
*http://mirror.ihug.co.nz/archlinux/
 +
*http://mirror.ece.auckland.ac.nz/archlinux/  ''NZ only''
 +
 +
===俄罗斯===
 +
*http://hatred.homelinux.net/archlinux/ - ''Vladivostok, without iso, with <sub>[http://hatred.homelinux.net/wiki/proekty:3spy:start 3SPY]</sub> project repos and [http://hatred.homelinux.net/archlinux/mingw32/os/i686 '''mingw32'''] repo''
 +
 +
===南非===
 +
*http://ftp.sun.ac.za/ftp/pub/mirrors/archlinux/ - ''Stellenbosch University''
 +
*ftp://ftp.sun.ac.za/pub/mirrors/archlinux/
 +
*http://ftp.leg.uct.ac.za/pub/linux/arch/ - ''University of Cape Town''
 +
*ftp://ftp.leg.uct.ac.za/pub/linux/arch/
 +
 +
===美国===
 +
* http://archlinux.linuxfreedom.com - ''Contains numerous ISO images but does not contain the ISO dated 2011.08.19''
 +
* http://mirror.pointysoftware.net/archlinux/
 +
 +
==可以使用 IPv6 的镜像==
 +
*ftp.free.fr (France)
 +
*patroklos.noc.ntua.gr (Greece)
 +
*ftp.heanet.ie (Ireland)
 +
*ftp.nluug.nl (Netherlands)
 +
*ftp.surfnet.nl (Netherlands)
 +
*http://mirror6.bjtu.edu.cn/archlinux (China)
 +
*http://mirrors.inetutils.net/archlinux/ (Malaysia)
 +
*http://mirror.ece.vt.edu/archlinux/ (Virginia, US)
 +
 +
==疑难解答==
 +
 +
===Out-of-sync mirrors: corrupted packages/file not found===
 +
<!-- Here or [[pacman]]? Seems like a mirror issue more than pacman... -->
 +
Issues regarding out-of-sync mirrors pointed out in [https://www.archlinux.org/news/482/ 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 {{Ic|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 {{Ic|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.
 +
 +
===使用所有镜像===
 +
To emulate {{Ic|pacman -Su}}'s behavior of going through the entire mirror list, use this script:
 +
{{hc|~/bin/pacup|<nowiki>
 +
#!/bin/bash
  
# 挪威
+
# Pacman will not exit on the first error. Comment the line below to
*ftp://jane.tihlde.org/pub/archlinux/
+
# try from [testing] directly.
<sub>[http://jane.tihlde.org/pub/archlinux/ http] </sub>
+
pacman -Su "$@" && exit
*http://power.klette.us/mirror/
 
# 波兰
 
*ftp://ftp.icm.edu.pl/pub/Linux/sunsite/distributions/archlinux/
 
[http://ftp.icm.edu.pl/pub/Linux/sunsite/distributions/archlinux/ http] - up-to-date, but no Core repository
 
  
# 美国
+
while read -r pkg; do
*ftp://ftp.osuosl.org/pub/archlinux/
+
  if pacman -Ud "$pkg"; then
<sub>[http://ftp.osuosl.org/pub/archlinux/ http]</sub>  (i686 only - ''current'' and ''extra'') - outdated
+
    continue
*http://mirror.umoss.org/archlinux/
+
  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/,')
 +
</nowiki>}}
  
#中国
+
===Checking multiple mirrors with paccheck===
*http://mirrors.sohu.com/archlinux/
+
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).
  
== IPv6 镜像 ==
+
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.
*http://power.klette.us/mirror/ (挪威)
 
*niue.belnet.be (比利时)
 
*ftp.estpak.ee (爱沙尼亚)
 
*patroklos.noc.ntua.gr (希腊)
 
*ftp.heanet.ie (爱尔兰)
 
*ftp.nluug.nl (荷兰)
 
*ftp.surfnet.nl (荷兰)
 
*ftp.sixnix.net/ftp6.sixnix.net (芬兰) - dead
 
  
== Rsync 镜像 ==
+
The Full System Update Procedure is:
* 中国
+
# Run ''paccheck'' as a non-root user. Pacman will be synchronised and the needed packages will be downloaded.
# rsync://archlinux.gooth.cn/archlinux
+
# Examine report
 +
# If no package ''mismatch'', then run {{ic|pacman -Su}} as root to update your system
  
* 美国
+
The script can be found in the [[Arch User Repository|AUR]]: {{AUR|paccheck}}
# rsync://mirror.umoss.org/archlinux/ (全镜像,对学术机构不限流量)
 
# rsync://mirror.rit.edu/archlinux/
 
# rsync://mirror.umoss.org/archlinux/
 
  
澳大利亚
+
== 参见 ==
# rsync://mirror.pacific.net.au/linux/archlinux/
+
* [[http://wiki.gotux.net/code:bash:mirup MirUp]] -- pacman mirrorlist downloader/checker
# rsync://mirror.aarnet.au/pub/archlinux/
 
# rsync://mirror.internode.on.net/pub/archlinux/
 
* 巴西
 
# rsync://rsync.las.ic.unicamp.br/archlinux/
 
* 加拿大
 
# rsync://mirror.csclub.uwaterloo.ca/archlinux/
 
* 法国
 
# rsync://distrib-coffee.ipsl.jussieu.fr/pub/linux/archlinux/
 
# rsync://mir1.archlinuxfr.org/archlinux
 
# rsync://mir2.archlinuxfr.org/archlinux
 
* 德国
 
# rsync://ftp5.gwdg.de/pub/linux/archlinux/
 
# rsync: ftp.uni-kl.de::pub/linux/archlinux/
 
# rsync://rsync.uni-bayreuth.de/archlinux/
 
* 俄罗斯
 
rsync://mirror.yandex.ru/archlinux/
 
* 乌克兰
 
# rsync://hell.org.ua/archlinux/
 
* 挪威
 
# rsync://jane.tihlde.org/pub/archlinux/
 

Revision as of 05:10, 26 December 2011

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 – فارسی

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Mirrors (简体中文)#)
Template:Article summary start

Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary end

本页面说明如何选择和配置镜像,以及列出可用的镜像。

启用您喜爱的镜像

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].

镜像状态

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.

镜像排序

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.

按速度排序

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.

按速度和状态排序

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 #按速度排序, then sorting those 6 fastest mirrors by their #镜像状态.

Simply visit either one or both #镜像状态 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.

使用 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.

官方镜像

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.

非官方镜像

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

全球

保加利亚

中国

  1. CHINA TELECOM
  1. CHINA UNICOM

德国

印度尼西亚

立陶宛

马来西亚

新西兰

俄罗斯

南非

美国

可以使用 IPv6 的镜像

疑难解答

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.

使用所有镜像

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

参见

  • [MirUp] -- pacman mirrorlist downloader/checker