Centos – Equivalent yum command for `apt-get install -y packagename –no-upgrade`

aptcentosinstallationpackage-managementyum

I was using this command in a shell script on my ubuntu server apt-get install -y packagename --no-upgrade . It will install the package if it is not already present. It will not upgrade the package. Now I want to migrate it to a centos machine. I couldn't find any switch equivalent to --no-upgrade in yum. Any help?

Best Answer

There is no such option for yum.
You will have to work around it with something like this:

rpm --quiet -q packagename || yum -y install packagename