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

From ArchWiki
Jump to: navigation, search
(台湾 =)
(use https for links to archlinux.org)
(21 intermediate revisions by 7 users not shown)
Line 1: Line 1:
[[Category:软件包管理|jx]]
+
[[Category:About Arch (简体中文)]]
[[Category:HOWTOs (简体中文)|jx]]
+
[[Category:Package management (简体中文)]]
[[Category:简体中文]]
+
[[en:Mirrors]]
 
+
[[es:Mirrors]]
{{i18n_links_start}}
+
[[fr:Miroirs]]
{{i18n_entry|English|:Mirrors}}
+
[[it:Mirrors]]
{{i18n_entry|简体中文|:Arch镜像 (简体中文)}}
+
{{Article summary start|摘要}}
{{i18n_links_end}}
+
{{Article summary text|更新和管理软件包镜像}}
 +
{{Article summary heading|相关}}
 +
{{Article summary wiki|Mirroring}}
 +
{{Article summary wiki|pacman}}
 +
{{Article summary wiki|reflector}}
 +
{{Article summary end}}
  
 +
本页面说明如何选择和配置镜像,以及列出可用的镜像。
  
 
== 启用您喜爱的镜像 ==
 
== 启用您喜爱的镜像 ==
  
pacman默认的core仓库配置如下:
+
想要启用镜像,打开 {{ic|/etc/pacman.d/mirrorlist}} 并定位到你的地理区域。对您想使用的镜像取消注释。
 +
{{注意 | ftp.archlinux.org [https://www.archlinux.org/news/302/ 限速 50KB/s]}}  例如:
 +
 
 +
# Any
 +
# Server = <nowiki>ftp://mirrors.kernel.org/archlinux/$repo/os/$arch</nowiki>
 +
'''Server = <nowiki>http://mirrors.kernel.org/archlinux/$repo/os/$arch</nowiki>'''
 +
 
 +
参见 [[#镜像状态]] 和 [[#按速度排序]] 查看帮助选择镜像的工具。
 +
 
 +
{{小贴士|取消5个你最喜欢的镜像的注释,把他们放在 mirrorlist 文件最上方。这样你就很容易找到它们并且如果第一个镜像出问题可以很容易切换。这也让合并 mirrorlist 更新更容易。}}
  
 +
也可以在 {{ic|/etc/pacman.conf}} 中指定镜像。对于 ''[core]'' 仓库,默认设置是:
 
  [core]
 
  [core]
 
  Include = /etc/pacman.d/mirrorlist
 
  Include = /etc/pacman.d/mirrorlist
  
如果你想使用一个欧洲镜像作为默认镜像,只需将它添加到<tt>Include</tt>行前:
+
想要使用 ''HostEurope'' 镜像作为默认镜像,把它添加在 {{Ic|Include}} 行之前:
 
+
 
  [core]
 
  [core]
  Server = <nowiki>ftp://ftp.hosteurope.de/mirror/ftp.archlinux.org/core/os/i686</nowiki>
+
  '''Server = <nowiki>ftp://ftp.hosteurope.de/mirror/ftp.archlinux.org/core/os/$arch</nowiki>'''
 
  Include = /etc/pacman.d/mirrorlist
 
  Include = /etc/pacman.d/mirrorlist
<br>
 
'''edit:''' The release of pacman 3.1 introduced the /etc/pacman.d/mirrorlist with the variable $repo, no need to maintain separate list for each repository.
 
  
Pacman will now try to connect to this mirror first. You can do the same for ''testing'', ''extra'', ''community'' and ''unstable''.
+
pacman 会首先尝试链接这个镜像。如果需要的话,可以继续修改''[testing]'', ''[extra]'', ''[community]''部分。
  
'''Use the same mirror for all repositories. Otherwise packages may get installed that are incompatible to each other (like kernel26 from ''core'' and another (older) kernel module from ''extra'').'''
+
{{注意|如果镜像直接在 {{ic|pacman.conf}} 中声明,记得在所有的仓库使用同样的镜像。否则不相容的包就可能被安装。如 ''[core]'' 中的 linux 和 ''[extra]'' 中的旧的内核模块不相容。}}
  
== 官方镜像 ==
+
==镜像状态==
 +
可以通过访问如下网址检查镜像的状态:
 +
* https://www.archlinux.org/mirrors/status/
 +
* http://www.archlinux.de/?page=MirrorStatus
  
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.
+
[https://www.archlinux.org/mirrorlist/ 这里]可以自动生成最新的镜像列表,安装[[Reflector]]这个工具也可以自动检查和生成镜像列表。
  
Here is a hint to check just how up-to-date your chosen mirror is:
+
==镜像排序==
# pick a server and browse to "extra/os/"
+
===按速度排序===
# load [http://www.archlinux.org/ archlinux.org] in another tab or window
+
更快的源可以显著的提升pacman的性能,和arch的整体操作体验。可以使用 {{ic|rankmirrors}} 将镜像列表按速度排列。但是{{ic|rankmirrors}}不能测试这些源的速度。
# 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.
+
{{ic|cd}}到{{ic|/etc/pacman.d/}}目录:
 +
{{bc|# 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.'''
+
备份已经存在的{{ic|/etc/pacman.d/mirrorlist}}:
 +
{{bc|# cp mirrorlist mirrorlist.backup}}
  
=== 澳大利亚 ===
+
编辑{{ic|/etc/pacman.d/mirrorlist.backup}},取消要测速镜像前的注释。
*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>
+
  
=== 奥地利 ===
+
让rankmirrors带上参数{{ic|-n}}对这个备份文件{{ic|mirrorlist.backup}}执行操作,然后把输出重定向以方便生成一个新的/etc/pacman.d/mirrorlist源列表:
*ftp://gd.tuwien.ac.at/opsys/linux/archlinux/ <sub>[http://gd.tuwien.ac.at/opsys/linux/archlinux/ http]</sub>
+
{{bc|# rankmirrors -n 6 mirrorlist.backup > mirrorlist}}
 +
{{注意|'''-n 6''':将生成6个最接近的源,运行{{Ic|rankmirrors -h}}可查看所有可用选项。}}
  
=== 比利时 ===
+
'''强制 pacman 刷新软件包列表''':
*ftp://ftp.belnet.be/mirror/archlinux.org/ <sub>[http://ftp.belnet.be/mirror/archlinux.org/ http]</sub>
+
# pacman -Syy
  
=== 巴西 ===
+
{{Tip|传入两次{{Ic|--refresh}}或{{Ic|-y}}将强制更新所有软件包列表,即使系统认为它们已经是最新。'''每次修改镜像之后都应该使用{{Ic|pacman -Syy}}'''。}}
*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>
+
  
=== 加拿大 ===
+
===按速度和状态排序===
*ftp://mirror.csclub.uwaterloo.ca/archlinux/ <sub>[http://mirror.csclub.uwaterloo.ca/archlinux/ http]</sub> <sub>[rsync://mirror.csclub.uwaterloo.ca/archlinux/ rsync]</sub>
+
{{translateme (简体中文)}}
 +
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://ftp.sh.cvut.cz/MIRRORS/arch/ <sub>[http://ftp.sh.cvut.cz/MIRRORS/arch/ http]</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.
*ftp://ftp.estpak.ee/pub/archlinux/ <sub>[http://ftp.estpak.ee/pub/archlinux/ http]</sub>
+
  
=== 法国 ===
+
===Script to automate use of Pacman Mirrorlist Generator===
*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>
+
You can use the following shell script to update your mirrors based on the rankings produced by the [https://www.archlinux.org/mirrorlist/ Pacman Mirrorlist Generator]. If you do not live in the United States, you can change the country variable.
*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>
+
  
=== 英国 ===
+
{{hc|updatemirrors.sh|2=<nowiki>#!/bin/sh
*http://www.mirrorservice.org/sites/ftp.archlinux.org/
+
*ftp://mirrors.uk2.net/pub/archlinux/ <sub>[http://archlinux.mirrors.uk2.net/ http]</sub>
+
  
=== 希腊 ===
+
[ "$UID" != 0 ] && su=sudo
*ftp://ftp.ntua.gr/pub/linux/archlinux/ <sub>[http://ftp.ntua.gr/pub/linux/archlinux/ http]</sub>
+
  
=== 匈牙利 ===
+
country='us'
*ftp://ftp.mfa.kfki.hu/pub/mirrors/ftp.archlinux.org/
+
url="https://www.archlinux.org/mirrorlist/?country=$country&protocol=ftp&protocol=http&ip_version=4&use_mirror_status=on"
  
=== 爱尔兰 ===
+
tmpfile=$(mktemp --suffix=-mirrorlist)
*ftp://ftp.heanet.ie/mirrors/ftp.archlinux.org/ <sub>[http://ftp.heanet.ie/mirrors/ftp.archlinux.org/ http]</sub>
+
  
=== 以色列 ===
+
# Get latest mirror list and save to tmpfile
*http://mirror.isoc.org.il/pub/archlinux/
+
wget -qO- "$url" | sed 's/^#Server/Server/g' > "$tmpfile"
  
=== 意大利 ===
+
# Backup and replace current mirrorlist file
*ftp://mi.mirror.garr.it/mirrors/archlinux/ <sub>[http://mi.mirror.garr.it/mirrors/archlinux/ http]</sub>
+
{ 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://ftp.nluug.nl/pub/metalab/distributions/archlinux/ <sub>[http://ftp.nluug.nl/pub/metalab/distributions/archlinux/ http]</sub>
+
*ftp://ftp.surfnet.nl/pub/os/Linux/distr/archlinux/ <sub>[http://ftp.surfnet.nl/pub/os/Linux/distr/archlinux/ http]</sub>
+
  
=== 挪威 ===
+
===使用 Reflector===
*http://arch.likbilen.com/ (rsync 可用)
+
  
=== 波兰 ===
+
[[Reflector]]工具可以从[https://www.archlinux.org/mirrors/status/ 镜像状态]页面自动获取最新的镜像列表,过滤掉未及时同步的镜像,然后按照速度排序覆盖{{ic|/etc/pacman.d/mirrorlist}}。
*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/
+
  
=== 葡萄牙 ===
+
==官方镜像==
*ftp://cesium.di.uminho.pt/pub/archlinux/ <sub>[http://cesium.di.uminho.pt/pub/archlinux/ http]</sub>
+
官方镜像可以通过软件包 {{pkg|pacman-mirrorlist}} 获得。最新的镜像可以通过[https://www.archlinux.org/mirrorlist/ Pacman 镜像列表生成器]查询。
  
=== 罗马尼亚 ===
+
如果没有配置任何镜像,也没有安装 {{Ic|pacman-mirrorlist}},请运行如下命令:
*ftp://ftp.iasi.roedu.net/mirrors/archlinux.org/ <sub>[http://ftp.iasi.roedu.net/mirrors/archlinux.org/ http]</sub>
+
# wget -O /etc/pacman.d/mirrorlist <nowiki>https://www.archlinux.org/mirrorlist/all/</nowiki>
  
=== 俄罗斯 ===
+
取消选中镜像前的注释然后:
*ftp://mirror.yandex.ru/archlinux/ <sub>[http://mirror.yandex.ru/archlinux/ http]</sub> (rsync 可用)
+
# pacman -Syy
*http://archlinux.freeside.ru/
+
# pacman -S --force pacman-mirrorlist
  
=== 瑞典 ===
+
如果要将自己的镜像加入官方列表,请提出申请并将其加入下面的 [[#非官方镜像]] 列表。
*ftp://ftp.ds.hj.se/pub/os/linux/archlinux/ <sub>[http://ftp.ds.hj.se/pub/os/linux/archlinux/ http]</sub>
+
*ftp://ftp.gigabit.nu/ <sub>[http://ftp.gigabit.nu/ http]</sub>
+
  
=== 瑞士 ===
+
如果碰到 {{ic|$arch}} 变量未定义的问题,请在 {{ic|/etc/pacman.conf}} 中加入:
*ftp://archlinux.puzzle.ch/ <sub>[http://archlinux.puzzle.ch/ http]</sub>
+
Architecture = auto
  
=== 土耳其 ===
+
=== 支持 IPv6 的镜像 ===
*http://server.elsistech.com/archlinux/
+
[https://www.archlinux.org/mirrorlist/?country=all&protocol=http&ip_version=6 pacman 镜像列表生成工具] 可以用来查找当前的 IPv6 镜像。
  
=== 乌克兰 ===
+
==非官方镜像==
*ftp://hell.org.ua/archlinux/ (rsync 可用)
+
These mirrors are ''not'' listed in {{ic|/etc/pacman.d/mirrorlist}}.
*ftp://ftp.linux.kiev.ua/pub/Linux/ArchLinux/ <sub>[http://ftp.linux.kiev.ua/pub/Linux/ArchLinux/ http]</sub>
+
  
=== 美国 ===
+
===全球===
*ftp://ftp.archlinux.org/
+
* http://sourceforge.net/projects/archlinux/files/ - ''Does not have recent ISO releases. Use it only if for getting older ISOs.''
*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)
+
*http://mirror.telepoint.bg/archlinux/  
 +
*ftp://mirror.telepoint.bg/archlinux/
  
=== 台湾 ===
+
===中国===
* ftp://ftp.tku.edu.tw/Linux/ArchLinux/
+
# CHINA TELECOM
* http://ftp.tku.edu.tw/Linux/ArchLinux/
+
*http://mirror.lupaworld.com/archlinux/
* ftp://ftp.mirror.tw/pub/ArchLinux/
+
* http://ftp.mirror.tw/pub/ArchLinux/
+
  
== 中国镜像 ==
+
# CHINA UNICOM
# 电信
+
*http://mirrors.sohu.com/archlinux/
#* http://mirrors.163.com/archlinux/ (隔天更新,速度很快)
+
#* http://mirror.lupaworld.com/archlinux/
+
  
# 网通
+
===德国===
#* ftp://xde.gooth.cn/
+
*http://ftp.uni-erlangen.de/mirrors/archlinux/
#* http://mirrors.sohu.com/archlinux/
+
*ftp://ftp.uni-erlangen.de/mirrors/archlinux/
 +
*http://ftp.u-tx.net/archlinux/
 +
*ftp://ftp.u-tx.net/archlinux/
  
# 教育网
+
===印度尼西亚===
#* http://ftp.sjtu.edu.cn/pub/mirror2/www.archlinux.org/
+
*http://mirror.kavalinux.com/archlinux/ - ''only from Indonesia''
#* http://program.net9.org/archlinux/www.archlinux.org/ (清华IPv6 & IPv4, 有KDEMod Mirror http://program.net9.org/archlinux/kdemod/ )
+
*http://kambing.ui.ac.id/archlinux/
#* http://mirror.bjtu.edu.cn/archlinux
+
*http://repo.ukdw.ac.id/archlinux/
#* http://mirror6.bjtu.edu.cn/archlinux (IPv6, 北京交通大学)
+
  
== 非官方镜像 ==
+
===立陶宛===
'''These mirrors are not listed in <code>/etc/pacman.d/mirrorlist</code>.'''
+
*http://edacval.homelinux.org/mirrors/archlinux/ - ''Only from LT, without ISO''
  
# 全球
+
===马来西亚===
*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.oscc.org.my/archlinux/
 +
*http://mirrors.inetutils.net/archlinux/ - ''ISO and Core''
  
# 澳大利亚
+
===新西兰===
*ftp://mirror.internode.on.net/pub/archlinux/
+
*http://mirror.ihug.co.nz/archlinux/
<sub>[http://mirror.internode.on.net/pub/archlinux/ http]</sub>
+
*http://mirror.ece.auckland.ac.nz/archlinux/ ''NZ only''
  
# 马来西亚
+
===俄罗斯===
*http://oss.mmu.edu.my/distro/arch (ISOs 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://mirror.oscc.org.my/archlinux/
+
  
# 挪威
+
===南非===
*ftp://jane.tihlde.org/pub/archlinux/
+
*http://ftp.sun.ac.za/ftp/pub/mirrors/archlinux/ - ''Stellenbosch University''
<sub>[http://jane.tihlde.org/pub/archlinux/ http] </sub>
+
*ftp://ftp.sun.ac.za/pub/mirrors/archlinux/
*http://power.klette.us/mirror/
+
*http://ftp.leg.uct.ac.za/pub/linux/arch/ - ''University of Cape Town''
# 波兰
+
*ftp://ftp.leg.uct.ac.za/pub/linux/arch/
*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
+
  
# 美国
+
===美国===
*ftp://ftp.osuosl.org/pub/archlinux/
+
* http://archlinux.linuxfreedom.com - ''Contains numerous ISO images but does not contain the ISO dated 2011.08.19''
<sub>[http://ftp.osuosl.org/pub/archlinux/ http]</sub>  (i686 only - ''current'' and ''extra'') - outdated
+
* http://mirror.pointysoftware.net/archlinux/
*http://mirror.umoss.org/archlinux/
+
  
#中国
+
==疑难解答==
*http://mirrors.sohu.com/archlinux/
+
 
 +
===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
 +
# 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/,')
 +
</nowiki>}}
 +
 
 +
===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).
  
== 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 01:17, 6 December 2012

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

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

启用您喜爱的镜像

想要启用镜像,打开 /etc/pacman.d/mirrorlist 并定位到你的地理区域。对您想使用的镜像取消注释。

注意: ftp.archlinux.org 限速 50KB/s
例如:
# Any
# Server = ftp://mirrors.kernel.org/archlinux/$repo/os/$arch
Server = http://mirrors.kernel.org/archlinux/$repo/os/$arch

参见 #镜像状态#按速度排序 查看帮助选择镜像的工具。

小贴士: 取消5个你最喜欢的镜像的注释,把他们放在 mirrorlist 文件最上方。这样你就很容易找到它们并且如果第一个镜像出问题可以很容易切换。这也让合并 mirrorlist 更新更容易。

也可以在 /etc/pacman.conf 中指定镜像。对于 [core] 仓库,默认设置是:

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

想要使用 HostEurope 镜像作为默认镜像,把它添加在 Include 行之前:

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

pacman 会首先尝试链接这个镜像。如果需要的话,可以继续修改[testing], [extra], 和 [community]部分。

注意: 如果镜像直接在 pacman.conf 中声明,记得在所有的仓库使用同样的镜像。否则不相容的包就可能被安装。如 [core] 中的 linux 和 [extra] 中的旧的内核模块不相容。

镜像状态

可以通过访问如下网址检查镜像的状态:

这里可以自动生成最新的镜像列表,安装Reflector这个工具也可以自动检查和生成镜像列表。

镜像排序

按速度排序

更快的源可以显著的提升pacman的性能,和arch的整体操作体验。可以使用 rankmirrors 将镜像列表按速度排列。但是rankmirrors不能测试这些源的速度。

cd/etc/pacman.d/目录:

# cd /etc/pacman.d

备份已经存在的/etc/pacman.d/mirrorlist:

# cp mirrorlist mirrorlist.backup

编辑/etc/pacman.d/mirrorlist.backup,取消要测速镜像前的注释。

让rankmirrors带上参数-n对这个备份文件mirrorlist.backup执行操作,然后把输出重定向以方便生成一个新的/etc/pacman.d/mirrorlist源列表:

# rankmirrors -n 6 mirrorlist.backup > mirrorlist
注意: -n 6:将生成6个最接近的源,运行rankmirrors -h可查看所有可用选项。

强制 pacman 刷新软件包列表

# pacman -Syy
Tip: 传入两次--refresh-y将强制更新所有软件包列表,即使系统认为它们已经是最新。每次修改镜像之后都应该使用pacman -Syy

按速度和状态排序

Tango-preferences-desktop-locale.png本页面需要更新翻译,内容可能已经与英文脱节。要贡献翻译,请访问简体中文翻译组Tango-preferences-desktop-locale.png

附注: please use the first argument of the template to provide more detailed indications.

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='us'
url="https://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

Reflector工具可以从镜像状态页面自动获取最新的镜像列表,过滤掉未及时同步的镜像,然后按照速度排序覆盖/etc/pacman.d/mirrorlist

官方镜像

官方镜像可以通过软件包 pacman-mirrorlist 获得。最新的镜像可以通过Pacman 镜像列表生成器查询。

如果没有配置任何镜像,也没有安装 pacman-mirrorlist,请运行如下命令:

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

取消选中镜像前的注释然后:

# pacman -Syy
# pacman -S --force pacman-mirrorlist

如果要将自己的镜像加入官方列表,请提出申请并将其加入下面的 #非官方镜像 列表。

如果碰到 $arch 变量未定义的问题,请在 /etc/pacman.conf 中加入:

Architecture = auto

支持 IPv6 的镜像

pacman 镜像列表生成工具 可以用来查找当前的 IPv6 镜像。

非官方镜像

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

全球

保加利亚

中国

  1. CHINA TELECOM
  1. CHINA UNICOM

德国

印度尼西亚

立陶宛

马来西亚

新西兰

俄罗斯

南非

美国

疑难解答

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