为什么yum必须更新每个命令的回购?

yum做任何事情对我来说都是令人沮丧的。 例如,当search一个包,find它,然后尝试安装它时,这两个yum命令似乎运行完全相同的更新,只需几秒钟!

我能做些什么来加快速度?

 (oldcfft)~/workspace/panel (live)> yum search bz2 Loaded plugins: fastestmirror, presto Determining fastest mirrors epel/metalink | 14 kB 00:00 * base: mirror.5ninesolutions.com * epel: mirror.metrocast.net * extras: centos.unmeteredvps.net * updates: mirrors-pa.sioru.com 10gen | 951 B 00:00 10gen/primary | 12 kB 00:00 10gen 105/105 base | 3.7 kB 00:00 base/primary_db | 4.4 MB 00:09 epel | 4.2 kB 00:00 epel/primary_db | 5.5 MB 00:13 extras | 3.4 kB 00:00 extras/primary_db | 18 kB 00:00 nginx | 2.9 kB 00:00 nginx/primary_db | 24 kB 00:00 pgdg91 | 2.8 kB 00:00 pgdg91/primary_db | 123 kB 00:00 pgdg92 | 2.8 kB 00:00 pgdg92/primary_db | 112 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 4.4 MB 00:15 epel/pkgtags | 588 kB 00:01 ======================================================================== N/S Matched: bz2 ========================= bzip2.x86_64 : A file compression utility Name and summary matches only, use "search all" for everything. (oldcfft)~/workspace/panel (live)> sudo yum install -y bzip2 Loaded plugins: fastestmirror, presto Determining fastest mirrors epel/metalink | 14 kB 00:00 * base: mirror.es.its.nyu.edu * epel: mirror.us.leaseweb.net * extras: centos.unmeteredvps.net * updates: mirrors-pa.sioru.com 10gen | 951 B 00:00 10gen/primary | 12 kB 00:00 10gen 105/105 base | 3.7 kB 00:00 epel | 4.2 kB 00:00 epel/primary_db | 5.5 MB 00:15 extras | 3.4 kB 00:00 nginx | 2.9 kB 00:00 nginx/primary_db | 24 kB 00:00 pgdg91 | 2.8 kB 00:00 pgdg91/primary_db | 123 kB 00:00 pgdg92 | 2.8 kB 00:00 pgdg92/primary_db | 112 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 4.4 MB 00:10 Setting up Install Process Package bzip2-1.0.5-7.el6_0.x86_64 already installed and latest version Nothing to do 

你首先运行yum search作为普通用户,然后以root身份(使用sudo )运行。

作为根的调用将其caching数据存储在/var/cache/yum ,这对于普通用户是不可写的。 所以,当你把它作为你自己的用户帐户运行时,必须再次下载并存储在另一个临时目录中。

要解决此问题,请始终在root shell或sudo运行yum

使用选项-C来使用有关存储库信息的caching版本等。从手册页:

  -C, --cacheonly Tells yum to run entirely from system cache - does not down- load or update any headers unless it has to to perform the requested action. If you're using this as a user yum will not use the tempcache for the user but will only use the system cache in the system cachedir.