错误描述:

[root@test ~]# yum repolist

Loaded plugins: fastestmirror, security

Existing lock /var/run/yum.pid: another copy is running as pid 1696.

Another app is currently holding the yum lock; waiting for it to exit...

  The other application is: yum

    Memory :  21 M RSS (861 MB VSZ)

    Started: Thu Nov 16 14:40:42 2017 - 03:07 ago

    State  : Traced/Stopped, pid: 1696

Another app is currently holding the yum lock; waiting for it to exit...

  The other application is: yum

    Memory :  21 M RSS (861 MB VSZ)

    Started: Thu Nov 16 14:40:42 2017 - 03:09 ago

    State  : Traced/Stopped, pid: 1696

Another app is currently holding the yum lock; waiting for it to exit...

  The other application is: yum

    Memory :  21 M RSS (861 MB VSZ)

    Started: Thu Nov 16 14:40:42 2017 - 03:11 ago

    State  : Traced/Stopped, pid: 1696


####错误关键句: Another app is currently holding the yum lock; waiting for it to exit...

                  yum运行时提示被锁住了

 


解决方案:


第一步  解决错误


yum运行时提示被锁住了解决办法

1、当大家用linux的yum时,是不是经常会遇到下面的情况

Loaded plugins: fastestmirror

Existing lock /var/run/yum.pid: another copy is running as pid 3404.

Another app is currently holding the yum lock; waiting for it to exit...

The other application is: yum

Memory : 41 M RSS (253 MB VSZ)

Started: Wed Apr 11 07:03:37 2012 - 00:25 ago

State : Sleeping, pid: 3404

没关系,两条语句就可以搞定它。

2、[root@centos5 ~]# rm -r /var/run/yum.pid

rm:是否删除 一般文件 “/var/run/yum.pid”? y

[root@centos5 ~]# /sbin/service yum-updatesd restart

停止 yum-updatesd: [确定]

启动 yum-updatesd: [确定]

3、[root@centos5 ~]# yum install gcc*

搞定!!!


第二步 再进行安装yum


[root@test ~]# yum repolist                 #此命令不仅是安装yum的命令 还可以对yum进行更新

Loaded plugins: fastestmirror, security

Loading mirror speeds from cached hostfile

 * base: mirrors.aliyun.com

 * extras: mirrors.aliyun.com

 * updates: mirrors.aliyun.com

base                                                                                              | 3.7 kB     00:00     

base/primary_db                                                                                   | 4.7 MB     00:20     

extras                                                                                            | 3.4 kB     00:00     

extras/primary_db                                                                                 |  29 kB     00:00     

updates                                                                                           | 3.4 kB     00:00     

updates/primary_db                                                                                | 4.7 MB     00:20     

repo id                                  repo name                                                                 status

base                                     CentOS-6 - Base - mirrors.aliyun.com                                      6,706

extras                                   CentOS-6 - Extras - mirrors.aliyun.com                                       46

updates                                  CentOS-6 - Updates - mirrors.aliyun.com                                     756

repolist: 7,508



第三步  安装、备份与更新yum源

资源网站:http://mirrors.aliyun.com


备份yum源:

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup


下载yum源:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo


下载epel源

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo


小结:

yum repolist

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

yum -y install sl                   #进行安装需要的软件