当 RHEL 及 CentOS 用 Yum 安装或更新套件时, 如果有其他 process 正在使用 Yum, 那么 Yum 就会 lock 起, 并出现类似这样的错误:
Loaded plugins: fastestmirror
Existing lock /var/run/yum.pid: another copy is running as pid xxx
Another app is currently holding the yum lock; waiting for it to exit…
要解决只要 kill 掉那个 process 就可以, 但为了安全起见在 kill 前可以先查看那一个 process 及帐号使用 Yum:
ps aux | grep yum
上面指令可以查看那一个 process 及帐号正在使用 Yum, 那现在可以等待那个 process 执行完成, 或者直接 kill 那个 process:
kill -9 2195
之后就可以用 Yum 安装及更新套件了。