有没有一个命令来做到这一点:如果一个软件包已经安装,更新它,否则安装最新版本
现在我正在做两个命令:
yum install mypackage yum update mypackage
也许有一个更有效的方法?
至less对我来说, yum是足够明亮的,如果我告诉它安装一些已经安装的东西,并且有更新可用,它就会应用更新。 例如:
[root@risby ~]# rpm -qa|grep openvpn openvpn-2.2.2-7.fc17.x86_64
openvpn已安装。
[root@risby ~]# yum update [...] --> Running transaction check ---> Package openvpn.x86_64 0:2.2.2-7.fc17 will be updated ---> Package openvpn.x86_64 0:2.3.1-2.fc17 will be an update
有可用的更新。
[root@risby ~]# yum install openvpn [...] --> Running transaction check ---> Package openvpn.x86_64 0:2.2.2-7.fc17 will be updated ---> Package openvpn.x86_64 0:2.3.1-2.fc17 will be an update
yum install无论如何都是正确的。 yum版本是3.4.3,顺便说一下。