rpm -Uvh --oldpackage [filename]

--oldpackage allows you to install older versions, -U means "upgrade", but in this case it will just replace the other version. If you use -i instead of -U you will end up with both versions installed.

Answer from Harley on serverfault.com
Top answer
1 of 1
10

Using RPM

Try the following:

$ rpm -Uvh --oldpackage pkg1.rpm pkg2.rpm

excerpt from rpm man page

   rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...

   This upgrades or installs the package currently installed to a newer 
   version.  This is the same as install, except all other version(s) of the  
   package are removed after the new package is installed.

   --oldpackage
          Allow an upgrade to replace a newer package with an older one.

Using YUM + downgrade

With yum you should be able to do the following as well:

$ yum downgrade /path/pkg1.rpm /path/pkg2.rpm

Using YUM + history undo

If you previously had pkgX-1.0 installed and then upgraded it to pkgX-1.1, you should be able to use yum history to see this upgrade and yum history undo to revert this too.

excerpt from yum man page on history

The undo/redo/rollback commands take either a single transaction id or the keyword last and an offset from the last transaction (Eg. if you've done 250 transactions, "last" refers to transaction 250, and "last-4" refers to transaction 246). The redo command can also take some optional arguments before you specify the transaction. "force-reinstall" tells it reinstall any packages that were installed in that transaction (via install, upgrade or downgrade). "force-remove" tells it to forcibly remove any packages that were updated or downgraded.

The undo/redo commands act on the specified transaction, undo'ing or repeating the work of that transaction. While the rollback command will undo all transactions up to the point of the specified transaction. For example, if you have 3 transactions, where package A; B and C where installed respectively. Then "undo 1" will try to remove package A, "redo 1" will try to install package A (if it is not still installed), and "rollback 1" will try to remove packages B and C. Note that after a "rollback 1" you will have a fourth transaction, although the ending rpmdb version (see: yum version) should be the same in transactions 1 and 4.

To see your YUM history:

$ sudo yum history | head
Loaded plugins: fastestmirror, langpacks, refresh-packagekit
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
   120 | install httpd            | 2014-08-26 09:19 | Install        |    5   
   119 | install pydf             | 2014-08-22 17:11 | Install        |    1   
   118 | install xsel             | 2014-08-22 13:29 | Install        |    1   
   117 | install pastebinit       | 2014-08-22 13:26 | Install        |    2   
   116 | install xorg-x11-apps-0: | 2014-08-21 11:04 | Install        |    2   
   115 | remove adobe-release-x86 | 2014-08-21 02:18 | Erase          |    1   
   114 | update                   | 2014-08-21 02:15 | E, I, O, U     |   67  <

To undo a particular transaction:

$ sudo yum history undo 120
Loaded plugins: fastestmirror, langpacks, refresh-packagekit, tsflags
Undoing transaction 120, from Tue Aug 26 09:19:17 2014
    Dep-Install apr-1.5.1-1.fc20.x86_64                 @updates
    Dep-Install apr-util-1.5.3-1.fc20.x86_64            @updates
    Dep-Install fedora-logos-httpd-21.0.1-1.fc20.noarch @fedora
    Install     httpd-2.4.10-1.fc20.x86_64              @updates
    Dep-Install httpd-tools-2.4.10-1.fc20.x86_64        @updates
Resolving Dependencies
--> Running transaction check
---> Package apr.x86_64 0:1.5.1-1.fc20 will be erased
---> Package apr-util.x86_64 0:1.5.3-1.fc20 will be erased
---> Package fedora-logos-httpd.noarch 0:21.0.1-1.fc20 will be erased
---> Package httpd.x86_64 0:2.4.10-1.fc20 will be erased
---> Package httpd-tools.x86_64 0:2.4.10-1.fc20 will be erased
--> Finished Dependency Resolution
...
Discussions

repository - downgrade rpm package from experimental repo just by disabling the repo and yum update - Stack Overflow
I have packages Foo-2.0.rpm and Foo-2.3.rpm. The former is normally distributed by the Linux distro but old. Foo-2.3 is the latest version, and the rpm I am making. I am writing the .spec file, and... More on stackoverflow.com
🌐 stackoverflow.com
RPM handling Upgrade and Downgrade like magic
Hello, I'm the current yum and dnf Ansible module maintainer upstream in Ansible. I'm also the original author of The RPM Packaging Guide and a Fedora Proven Packager , so I like to believe I'm a decent candidate to help resolve the issue you're facing and that I have a reasonable chance of success. I'd like to better understand what you're trying to accomplish, what the expected behavior you have of Ansible compared to what you're observing. I'm also very curious what you mean by "Ansible ends up installing RPMs alongside the previous version" and if you have any example playbook(s) that would help replicate the behavior you're observing including details about what distro(s) and release(s) the playbook(s) is/are being run on. I'm happy to continue the discussion here, but we can also have some synchronous communication to help move this along faster. I'm around on irc.freenode.net in #ansible and #ansible-devel as the irc nick maxamillion. Looking forward to hearing from you. More on reddit.com
🌐 r/ansible
25
5
April 14, 2020
How to repackage an rpm installed using dnf?
In order to have a way to revert back to the last version installed of a package in case the update fails I want to know if there is a way to repackage the currently installed package and save the rpm before the update is done? Otherwise is there a way to not erase the current version and save ... More on discussion.fedoraproject.org
🌐 discussion.fedoraproject.org
4
1
April 6, 2021
How to downgrade a package via zypper?
For a new issue, MAYBE because ... like to downgrade temporarily to the previous vesion of php-pear-Mail_Mime. I’ve the following zypper history: vserver:/var/log/zypp # grep -n php-pear-Mail_Mime history 43046:# 2019-12-06 10:02:00 php-pear-Mail_Mime-1.10.4-lp151.1.1.noarch.rpm installed ... More on forums.opensuse.org
🌐 forums.opensuse.org
0
0
March 9, 2020
People also ask

How do I downgrade an RPM package in Linux?
You can downgrade an RPM package using yum downgrade or rpm -Uvh --oldpackage. Yum is recommended as it handles dependencies automatically.
🌐
golinuxcloud.com
golinuxcloud.com › home › rpm downgrade in linux (yum, rpm, install specific version + rollback)
RPM Downgrade in Linux (yum, rpm, Install Specific Version + ...
What is the difference between yum and rpm for downgrade?
Yum resolves dependencies automatically, while rpm performs a direct installation. Yum is safer for most use cases, whereas rpm is used for manual or forced downgrades.
🌐
golinuxcloud.com
golinuxcloud.com › home › rpm downgrade in linux (yum, rpm, install specific version + rollback)
RPM Downgrade in Linux (yum, rpm, Install Specific Version + ...
How to prevent package upgrade after downgrade?
You can lock the package version using yum versionlock add to prevent it from being upgraded automatically.
🌐
golinuxcloud.com
golinuxcloud.com › home › rpm downgrade in linux (yum, rpm, install specific version + rollback)
RPM Downgrade in Linux (yum, rpm, Install Specific Version + ...
🌐
Red Hat
access.redhat.com › solutions › 32635
How to downgrade a package to previous version using rpm command? - Red Hat Customer Portal
How do I downgrade a package to a previous version using rpm command? Red Hat Enterpise Linux 9 · Red Hat Enterpise Linux 8 · Red Hat Enterpise Linux 7 · Red Hat Enterpise Linux 6 · A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.
🌐
Atomicorp
wiki.atomicorp.com › wiki › index.php › Downgrading_rpms
Downgrading rpms - Atomicorp Wiki
April 10, 2014 - If its not, then you will need to either download an older version of the rpms from our archives, or from your OS vendor depending on what version and build you want to use. ... Keep in mind that neither of these methods understands depdency downloading, so you will need to identify all the dependency packages that also need to be removed, and reinstalled. ... You can downgrade packages using two methods with yum,both of these are only supported with newer versions of yum.
🌐
GoLinuxCloud
golinuxcloud.com › home › rpm downgrade in linux (yum, rpm, install specific version + rollback)
RPM Downgrade in Linux (yum, rpm, Install Specific Version + Rollback) | GoLinuxCloud
March 18, 2026 - Learn how to downgrade RPM packages in Linux using yum and rpm. This guide covers installing specific versions, handling dependencies, forcing downgrade, rollback using yum history, and fixing common errors in CentOS, RHEL, and other RPM-based systems.
🌐
OpenText
docs.microfocus.com › SA › 10.50 › Content › SwProv_UG › package_management › RPMRollback.htm
RPM rollback
The SA RPM rollback function uses ... operations down to the time when the rollback point was created in reverse order: A package that was upgraded will be downgraded to its prior version;...
Find elsewhere
🌐
Vocera
pubs.vocera.com › platform › va › 1.4.3 › help › va_admin_help › platform › va › 1.4.3 › topics › va_rpm_verify.html
Verifying, Upgrading, or Downgrading the RPM versions
December 4, 2024 - sudo yum downgrade va-monitoring-1.2.0-426_398.x86_64 where va-monitoring-1.2.0-426_398.x86_64 is the RPM name.
🌐
Reddit
reddit.com › r/ansible › rpm handling upgrade and downgrade like magic
r/ansible on Reddit: RPM handling Upgrade and Downgrade like magic
April 14, 2020 -

Newbie Ansible user, but long time tech geek here.

It behooves me that Ansible can’t upgrade or downgrade a RPM package natively without programming conditional logic within the tasks area.

version=1.2.3

Ansible should install {{ version }} if nothing exists.

Perform an upgrade until the versions match if a package DOES exist.

Or downgrade to {{ version }} if the version is lower than installed.

Does anyone else have the same frustration I do?

Puppet handled this scenario automagically.

Ansible ends up installing RPMs alongside the previous version unless “latest” is used, but if I use that, I can downgrade via the version variable seen above.

name: install specific version
  yum:
    name: httpd-1.2.3
    state: present

Will result in this:

$rpm -qa | grep httpd
$httpd-1.2.3
$httpd-1.2.2

🌐
Red Hat
access.redhat.com › solutions › 29617
How to use yum/dnf to downgrade or rollback some package updates? - Red Hat Customer Portal
May 1, 2025 - Here we can see that the newer version of httpd, httpd-manual and mod_ssl altogether are reinstalled with the older version of those RPMs, and no package is going to be removed for dependencies. ... Downgrades are tricky but in yum versions 3.2.27 and above it can do _some_ downgrades.
🌐
Fedora Discussion
discussion.fedoraproject.org › ask fedora
How to repackage an rpm installed using dnf? - Fedora Discussion
April 6, 2021 - In order to have a way to revert back to the last version installed of a package in case the update fails I want to know if there is a way to repackage the currently installed package and save the rpm before the update is done? Otherwise is there a way to not erase the current version and save ...
🌐
openSUSE Forums
forums.opensuse.org › english › applications
How to downgrade a package via zypper? - Applications - openSUSE Forums
March 9, 2020 - For a new issue, MAYBE because ... like to downgrade temporarily to the previous vesion of php-pear-Mail_Mime. I’ve the following zypper history: vserver:/var/log/zypp # grep -n php-pear-Mail_Mime history 43046:# 2019-12-06 10:02:00 php-pear-Mail_Mime-1.10.4-lp151.1.1.noarch.rpm installed ...
🌐
Linux Questions
linuxquestions.org › questions › linux-software-2 › possible-to-downgrade-a-package-rpm-dependency-hell-61883
possible to downgrade a package? (rpm dependency hell)
May 26, 2003 - I installed freetype-2.1.4-1, and now I need to install freetype-devel. The problem is that freetype-devel requires freetype-2.1.3-6 (an older version)
🌐
HPE
support.hpe.com › hpesc › public › docDisplay
How to Configure and Use the "rpm --rollback" Feature
Important Note: Support Center is currently scheduled for planned maintenance between July 1, 2026, 9:30 PM PDT and July 1, 2026, 10:30 PM PDT. During this time, some site features may be temporarily unavailable. We apologize for this inconvenience · You have no new notifications
🌐
Learning Academy
learnacad.com › home › linux › centos › how to downgrade rpm package using yum?
How to downgrade RPM Package using YUM? - Learning Academy
April 19, 2018 - For my list I will using already install PHP rpm package name with downgrade argument, which let yum to automatically use the lower version to install and remove the current version of PHP.
🌐
OpenNet
opennet.ru › docs › RUS › rpm_guide › 293.html
6.2.2 Откат транзакций
Команда rpm -U --rollback весьма ограничена в своей функциональности. Опция --rollback действует только в отношении обновлений. Нельзя откатить первую установку пакета.
🌐
OpenText
docs.microfocus.com › SA › 10.51 › Content › SwProv_UG › package_management › UninstallingRPMPackages.htm
Uninstall RPM packages
With SA you can uninstall RPM packages and downgrade to a previous version of the RPM package using policies. To uninstall an RPM package from a managed server, you must first detach the policy from the server and then remediate the server against the software policy.
🌐
CopyProgramming
copyprogramming.com › howto › downgrade-rpm-version-on-centos
Centos: CentOS: How to Downgrade the RPM Version
May 19, 2023 - Rpm rename (obsolete) while updating deletes required, To accomplish this, I decided to obsolete the old (x.rpm) rpm. When I run the rpm –Uvh y.rpm on the new rpm here are the steps that takes place: -Pre … ... downgrade an rpm on a machine without yum rpm downgrade script in spec file downgrade rpm version on centos