Search code examples
linuxdebianaptitude

List previous versions available for a package and install one of them by apt-get


A 10.5-2 version of postgresql that is coming from the
deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main
repository has a problem, and I would like to return to the 10.4 version I know to be working the way I want.

an apt-cache madison postgresql-10 returns me these informations atm :
postgresql-10 | 10.5-2.pgdg90+1 | http://apt.postgresql.org/pub/repos/apt stretch-pgdg/main amd64 Packages postgresql-10 | 10.5-2.pgdg90+1 | http://apt.postgresql.org/pub/repos/apt stretch-pgdg/main Sources

How can I find the previous packages version(s) existing for 10.4 ?
When I try to use a version number I found somewhere (on chocolatey website : I had no clue about how to search and was a bit lost), it didn't succeed : sudo apt-get install postgresql-10=10.4.0.20180721 E: Version '10.4.0.20180721' for 'postgresql-10' was not found

Going to the postgresql repository, http://apt.postgresql.org/pub/repos/apt/dists/stretch-pgdg/, I didn't found a clue about how to get any previous version.

More generally, what is the way, through command line and aptitude commands, to list what previous versions can be installed for a package ?
Is there, for example, a standard that set another location for previous versions, like an archive repository I should always find in the form http://../archive/../, or something else ?

Thanks !


Solution

  • apt-cache showpkg <package-name> will list all the available versions

    Either of these

    • apt install <package-name>=<package-version-number>
    • apt -t=<target release> install <package-name>

    apt-mark hold <package-name> will prevent automatic upgrades

    postgresql is now on version 11 is available from the main website.

    On github, next to "make a pull request" click on master, change selection to '10 stable', then make a pull request. You'll need to fix the bug if 10 stable is 10.5. If this isn't easy, you can compare code from 9.5 stable - only 1066 files that were altered and go through changing them. Stinks that they didn't actually keep tags for other versions.

    Sources: https://askubuntu.com/questions/138284/how-to-downgrade-a-package-via-apt-get#138327

    Edit: Don't forget to update before you check for the available packages.