How do I fetch a specific package version from a repository?

6,193

Solution 1

It seems as though using apt-get install php5=5.6.* to match the version number solves the problem.

Looking on launchpad, version 4.6.8 no longer exists, only version 4.6.9 exists.

Similarly, the ppa:git-core/ppa PPA on launchpad only contains versions 2.4.2 and 2.3.7. It seems as though the latest patch release of each minor version is kept.

Using this meaning I can tie the install to a particular minor release, while still receiving patch updates.

Solution 2

You can only install the latest version from a PPA, as old versions are deleted when new versions of a package are built and published in a PPA.

Solution 3

@Dobey answer seems to be the best solution in your situation. Though if you installed a package from a specific PPA what you can do is to mark that package when it's installed so to keep that version. For example run:

sudo apt-mark hold packagename

Solution 4

You can sometimes get old versions, depending on the source. For the most part, when a package is updated, it replaces the previous updated version (some repos keep the first version for that release, until the release goes End Of Life). This also depends on whether newer versions include security updates, or are no longer supported 'upstream' (where the package came from).

If the version you want to install is still in the repository, you can use this syntax to install the package:

sudo apt-get install apache2=2.2.20-1ubuntu1

If is not available from the repo you are using, you may be able to get the package from elsewhere.

With the PPA you seem to be using, you can currently get version 5.6.9. But there is another PPA by the author, from which you can get version 5.5.25. (There is also this one with 5.4.41, but only really for 12.04)

There are also third-party sites that often have old (and sometimes newer) versions. For Ubuntu, Ubuntu Updates (there other sites as well - e.g. for Fedora etc there is rpmfind (yes, RPMs.... - you can use alien (see below), or get the src.rpm and use the stuff in that to build something usable in non-RPM systems :D).

If all else fails, you can get try to a get a source version of the version you want (for PHP, see here), and then make the packages from that. This you can build and install directly, or build deb package(s) out of it and install those.

You can also use alien to install packages not in the deb format (this seems to include tar.gz).

Share:
6,193

Related videos on Youtube

dannyw88
Author by

dannyw88

Updated on September 18, 2022

Comments

  • dannyw88
    dannyw88 almost 2 years

    Adding a PPA then running apt-get update to fetch seems to only fetch the latest version from that PPA, but I would like to install a specific version.

    Eg: I'm adding the ondrej/php5-5.6 ppa. After an update, apt-cache policy php5 shows me that the available versions are:

    • 5.6.9+dfsg-1+deb.sury.org~trusty+2
    • 5.5.9+dfsg-1ubuntu4.9
    • 5.5.9+dfsg-1ubuntu4

    A few days ago, the latest version from the PPA was 5.6.8+dfsg-1+deb.sury.org~trusty+4, but now it has updated. This means that I can't run an apt-get install and install the particular version I want.

    Is this possible using apt?

    • Wilf
      Wilf about 9 years
      Which PPA are you using?
    • dannyw88
      dannyw88 about 9 years
      For clarity, I'm looking to be able to fetch particular versions from PPA's in general, not trying to avoid new releases of PHP. This just happens to be the example in front of me
    • dannyw88
      dannyw88 about 9 years
      @Wilf I'm adding ppa:ondrej/php5-5.6, using add-apt-repository
    • dannyw88
      dannyw88 about 9 years
      @Virusboy, thanks for the tip - I investigated and think I found the solution I was after
  • Thomas Ward
    Thomas Ward about 9 years
    This 'solves the problem' only in such that the repository has to have that version. If you have multiple PPAs that's one thing, but if the version available in the repos is higher than you have downloaded/cached on your system, it's not going to work. (There are no transactional updates in apt repos)