#########################
Downloading RPMs in Linux
#########################


   .. note:: This article is provide as a courtesy. Please contact your OS vendor for assistance with downgrading rpms.


   
Using RPM to downgrade a Package
==================================

Lets start with rpm, because all systems support this option. To rollback an rpm you need to have the original RPMs, which may be on your system in this directory:

   .. code-block:: console
	  
      /var/cache/yum/

		 
You'll have to look thru the subdirectories to see if the original RPMs are still cached by your system. 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.		 
   
   
**Method 1:**

   Step 1: Remove thr original RPMs by running the following command for each RPM
   
      .. code-block:: console
	 
         rpm -e -nodeps packagename


   Step 2: Install the older software by running the following command
   
      .. code-block:: console
	  
         rpm -Uvh packagename.oldversion.rpm


		 
**Method 2:**

   Step 1: Use the RPMs oldpackage feature by running the following command
   
      .. code-block:: console
	  
         rpm -Uvh --oldpackage packagename.oldversion.rpm


		 
.. note:: Keep in mind that neither of these methods understands dependency downloading, so you will need to identify all the dependency packages that also need to be removed, and reinstalled.



-------------

Using Yum to Downgrade a Package
================================

You can downgrade packages using two methods with yum,both of these are only supported with newer versions of yum. If they do not work on your system, then you will need to use the rpm methods above.

**Method 1:**

   Step 1: Remove the software by running the following command
   
      .. code-block:: console
	  
         yum remove packagename
		 
		 
   Step 2: Reinstall an older version using the --allow-downgrade option
   
      .. code-block:: console
	  
         yum --allow-downgrade install package-1.2.3.4


   Step 3: Finally, since you downgraded, yum will need to know not to upgrade this package, so add the package to **/etc/yum.conf** like the following
   
      .. code-block:: console
	  
         vim /etc/yum.conf
		 
         #Add the following lines based off of your package name
		 
         #exclude packages from updated
		 
         exclude=mysql
		 
		 
**Method 2:**

   Step 1: Run the following command
   
      .. code-block:: console
	  
         yum downgrade package-1.2.3.4


   .. note:: The step above will install version 1.2.3.4 of the package on your system. Keep in mind that in older versions of yum that support "downgrade", the depsolver doesn't understand how to do dependency downgrades in yum. If you have one of those versions of yum you will also need to specify anything that is dependent on the package downgrade. If you have a newer version yum, it should work out the dependencies for you.

