使用yum安装,结果提示:

yum -y install ansible

Another app is currently holding the yum lock; waiting for it to exit... The other application is: PackageKit Memory : 87 M RSS (844 MB VSZ) Started: Wed May 30 19:20:37 2018 - 07:36 ago State : Sleeping, pid: 9958

可能是系统自动升级正在运行,yum在锁定状态中。 已经有一个yum进程在运行了,使用kill干掉它:

kill -s 9 9958

ps aux|grep yum

root 9958 0.7 6.5 871192 96192 ? SN 19:20 0:07 /usr/bin/python/usr/share/PackageKit/helpers/yum/yumBackend.py get-updates none

很遗憾,kill对付不了它,那怎么办呢?

可以通过强制关掉yum进程:

rm -f /var/run/yum.pid

然后就可以使用yum了