When a PPA has a package of the same name in the Ubuntu Software Center

If a PPA in your sources list has a package of the same name in the Ubuntu Software Center, which one shows up in the software center. Likewise, which package is downloaded via apt-get install ?


Solution 1:

Package priority

The priorities of package sources is defined in the local package configuration.
This configuration can be inspected with apt-cache policy.

Here is an example of what apt-cache policy shows for the package git that is available in the Ubuntu main package repository, and in a PPA, and the PPA version is currently installed:

$ apt-cache policy git
git:
  Installed: 1:2.1.0-1~ppa0~ubuntu14.04.1
  Candidate: 1:2.1.0-1~ppa0~ubuntu14.04.1
  Version table:
 *** 1:2.1.0-1~ppa0~ubuntu14.04.1 0
        500 http://ppa.launchpad.net/git-core/ppa/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status
     1:1.9.1-1 0
        500 http://de.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

The numbers in front of the URLs specify the priority. The package from a source with the highest priority is preferred, if there is only one source with this priority.

Newer package of equal priority

If there are multiple entries of the highest priority, as it is the case here, the newer version is preferred.

Change priorities

To change the priorities to prefer a specific version, exceptions rules can be defined in /etc/apt/preferences. Locking a package to a fixed version is called "pinning".
See PinningHowto.

Solution 2:

Whichever repo has the latest version of the package is the one shown in the Ubuntu Software center and downloaded with apt-get install. It is like this by default, but can be changed in the Software Repositories window.