Installation of previous/old versions of packages in Debian

Recently, I encountered a problem installing the previous version of php on Debian. (I'm using the testing branch, php came as 5.6.x, but I needed to roll back to 5.5.x). Let's see how we can install the previous version.

1. Go to and enter the desired package in the search (for example, php5).

2. In the list, select the desired version (for example, 5.5.12+dfsg-2), go to it, select the repository where it was last seen (in my case, we see "Seen in debian on 2014-05-12 23:24:48 in /pool/main/p/php5.", click on the link. Modify the address from to (convert to the repository address), add to sources.list:

nano /etc/apt/sources.list
deb testing main non-free contrib
deb testing main non-free contrib

deb main testing


(The last line is added)

3. Then update the indexes:

aptitude -o Acquire::Check-Valid-Until=false update

Now let's see the available versions of php (for example):

aptitude show -v php5

5. Then install the specific version:

aptitude install php5=version

For example:

aptitude install php5=5.5.12+dfsg-2

(Also, most likely, you will need to downgrade php5-cli). Then follow the hints of aptitude, choose a reasonable option with the downgrade of php5 - packages, not the removal of over 9000 packages. 6. It may be useful to freeze the package from further update:

aptitude hold package_name

To undo:

aptitude unhold package_name