ubuntu9.com为Ubuntu提供了更新sources.list以获得高速apt源镜像的方法。
截止目前,该网站支持
- Ubuntu 10.04 LTS(Lucid Lynx)
- Ubuntu 10.10 (Maverick Meerkat)
- Ubuntu 11.04 (Natty Narwhal)
- Ubuntu 11.10 (Oneiric Ocelot)
对于最近更新,可以参考官网[1]。
1.最快apt源镜像
sudo wget -O /etc/apt/sources.list http://mirror.ubuntu9.com/topmirror/sourceslist/topfast?CODE
/!\注意:在运行前,请将CODE改成对应的Ubuntu版本,如Ubuntu 10.04 LTS(Lucid Lynx):
sudo wget -O /etc/apt/sources.list http://mirror.ubuntu9.com/topmirror/sourceslist/topfast?lucid
我们可以使用下面的方法自动获取Ubuntu版本代码:
lsb_release -c | cut -f2
因此有通用格式:
sudo wget -O /etc/apt/sources.list http://mirror.ubuntu9.com/topmirror/sourceslist/topfast?`lsb_release -c | cut -f2`
2.最近apt源镜像
sudo wget -O /etc/apt/sources.list http://mirror.ubuntu9.com/topmirror/sourceslist/topnear?`lsb_release -c | cut -f2`
3.最稳定apt源镜像
sudo wget -O /etc/apt/sources.list http://mirror.ubuntu9.com/topmirror/sourceslist/topstable?`lsb_release -c | cut -f2`
4.获取以上所有apt源镜像
sudo wget -O /etc/apt/sources.list.d/0_top_fast.list http://mirror.ubuntu9.com/topmirror/sourceslist/topfast?`lsb_release -c | cut -f2` && wget -O /etc/apt/sources.list.d/1_top_near.list http://mirror.ubuntu9.com/topmirror/sourceslist/topnear?`lsb_release -c | cut -f2` && wget -O /etc/apt/sources.list.d/2_top_stable.list http://mirror.ubuntu9.com/topmirror/sourceslist/topstable?`lsb_release -c | cut -f2`
References:
[1] UbuntuNight – About Us
[2] Tips: 通过一条命令获取最快的 apt 源镜像
搬瓦工
2016-05-05 at 22:32
稍微麻烦了一点,应用的话直接用一键包。