如果在你安装有ubuntu系统机器上经常感到apt-get安装速度过慢,那么这里就有几种改善这一情况的方法。
你有没有考虑过改变正被使用的默认镜像站点?你有没有排除因特网连接的上游宽带成为瓶颈的可能?
如果不是这些原因,你可以尝试第三个选择:使用apt-fast工具。apt-fast实际上是一个困扰apt-get和aptitude所写
的shell脚本容器,它能加速包的下载速度。apt-fast本质上采用aria2下载工具,这款工具能够以“块”的方式从多个
镜像并行下载一个文件。
在Ubuntu14.04或者10版本如下:
$ sudo add-apt-repository ppa:saiarcot895/myppa
$ sudo apt-get update
$ sudo apt-get install apt-fast
在Ubuntu11.04到13.10版本如下:
$ sudo apt-get-repository ppa:apt-fast/stable
$ sudo apt-get update
$ sudo apt-get install apt-fast
在安装期间需要选择默认的软件包管理器,如果你的系统有多个软件包管理器,那么就会提示你让你选择的,
选择你最常用的就好,一般是apt-get。笔者的机器只有一个软件包管理器,就没有出现这个步骤,直接默认
是apt-get。
接着就是最大的连接数。使用过Uget这款下载工具的朋友估计都知道aria2,所以,最好将默认的连接
数5改成16,这样速度能快不少。
下一步直接选择NO(或者 否 )。
这些配置都可以在/etc/apt-fast.conf里面配置。不是说现在配置了就不好修改。
好了,开始配置apt-get,或者说配置apt-fast:
完成安装后,你需要在/etc/apt-fast.conf里配置apt-fast使用的一系列镜像。
你可以去 https://launchpad.net/ubuntu/+archivemirrors 这个网址选择那些地理位置上靠近你的镜像。
$ sudo vim /etc/apt-fast.conf
添加以下代码:
MIRRORS=(‘http://mirror.lzu.edu.cn/ubuntu/,[url]ftp://mirror.lzu.edu.cn/ubuntu/[/url],[url]http://mirrors.aliyun.com/ubuntu/[/url],[url]http://ubuntu.cn99.com/ubuntu/[/url],[url]http://ftp.sjtu.edu.cn/ubuntu/[/url],[url]ftp://ftp.sjtu.edu.cn/ubuntu/[/url],[url]http://mirror.neu.edu.cn/ubuntu/[/url],[url]http://mirrors.163.com/ubuntu/[/url],[url]http://mirrors.sohu.com/ubuntu/[/url],[url]ftp://mirrors.sohu.com/ubuntu/[/url],[url]http://mirrors.tuna.tsinghua.edu.cn/ubuntu/[/url],[url]http://mirrors.ustc.edu.cn/ubuntu/[/url],[url]ftp://mirrors.ustc.edu.cn/ubuntu/[/url],[url]http://mirrors.yun-idc.com/ubuntu/[/url],[url]ftp://mirrors.yun-idc.com/ubuntu/[/url],[url]http://mirrors.zju.edu.cn/ubuntu/[/url],[url]http://mirrors.skyshe.cn/ubuntu/[/url],[url]http://mirror.bjtu.edu.cn/ubuntu/[/url],[url]ftp://mirror.bjtu.edu.cn/ubuntu/[/url],[url]http://mirrors.cug.edu.cn/ubuntu/[/url],[url]http://mirrors.hust.edu.cn/ubuntu/[/url],[url]http://mirrors.hustunique.com/ubuntu/[/url],[url]http://mirrors.oss.org.cn/ubuntu/[/url],[url]http://ubuntu.cnssuestc.org/ubuntu/[/url],[url]http://ubuntu.dormforce.net/ubuntu/[/url],[url]http://ubuntu.uestc.edu.cn/ubuntu/[/url],[url]http://free.nchc.org.tw/ubuntu/[/url],[url]ftp://free.nchc.org.tw/ubuntu[/url],[url]http://tw.archive.ubuntu.com/ubuntu/[/url],[url]ftp://tw.archive.ubuntu.com/ubuntu/[/url],[url]http://ftp.ubuntu-tw.net/mirror/ubuntu/[/url],[url]ftp://ftp.ubuntu-tw.net/mirror/ubuntu/[/url],[url]http://ftp.nsysu.edu.tw/Ubuntu/ubuntu/[/url],[url]http://ftp.stust.edu.tw/pub/Linux/ubuntu/[/url],[url]ftp://ftp.stust.edu.tw/pub/Linux/ubuntu/[/url],[url]http://ftp.tc.edu.tw/Linux/ubuntu/[/url],[url]ftp://ftp.tc.edu.tw/Linux/ubuntu/[/url],[url]http://ftp.tku.edu.tw/ubuntu/[/url],[url]ftp://ftp.tku.edu.tw/ubuntu/[/url],[url]http://ftp.yzu.edu.tw/ubuntu/[/url],[url]ftp://ftp.yzu.edu.tw/ubuntu/[/url],[url]http://ftp.ntou.edu.tw/ubuntu/[/url],[url]ftp://ftp.ntou.edu.tw/ubuntu/[/url],[url]http://ubuntu.cs.nctu.edu.tw/ubuntu/[/url],[url]ftp://ubuntu.cs.nctu.edu.tw/ubuntu/[/url],[url]http://ubuntu.stu.edu.tw/ubuntu/[/url],[url]ftp://ubuntu.stu.edu.tw/ubuntu/[/url],[url]http://mirror01.idc.hinet.net/ubuntu/[/url],[url]http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/[/url],[url]ftp://ftp.cuhk.edu.hk/pub/Linux/ubuntu/[/url],[url]http://ubuntu.01link.hk/[/url],[url]http://ubuntu.uhost.hk/’[/url])
当然也可以选择性的添加。笔者只是将中国大陆,台湾,香港的所有镜像列了出来。
自己添加的话要注意格式:
MIRRORS=(‘[镜像1],[镜像2],…’)
好了全部完成了,如何使用?
和apt-get基本一样。
比如:sudo apt-get update 换成 sudo apt-fast update
sudo apt-get dist-upgrade 换成 sudo apt-fast dist-upgrade
等等。
Over…