• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
WebSetNet

WebSetNet

Technology News

  • Technology News
    • Mobile
    • Games
  • Internet Marketing
  • System Admin
    • Windows
    • Linux
    • Mac & Apple
    • Website Scripts
      • Wordpress

How to Set Package, PPA, Apt Repository Priority in Ubuntu

March 1, 2021 by jerry23

This is a simple tutorial shows how to set the priority of a certain package and/or apt repository in Ubuntu, Debian, Linux Mint.

In Ubuntu, we install software packages from different sources, including Ubuntu universe repositories (using Ubuntu Software), Ubuntu PPAs (e.g., LibreOffice, Kodi, GIMP, and more), apps’ own apt repositories (e.g, Chrome, VirtualBox, Opera, and more).

We can even install apps from other Linux Distributions. For instance, installing Linux Mint’s IPTV player, Web App Mananger, and Chromium Browser (in deb format) in Ubuntu is possible.

Why setting priority:

However, installing from mixed software sources may cause following questions:

  1. Lock a package in specified version.
  2. More than one repositories have the same package, but you want to install or receive package updates from a certain repository.
  3. Install only one or two packages from the repository, but refuse all others.

Create and set package priority:

By adding a rule file under /etc/apt/preferences.d/ directory, and pinning a priority will fix the issues.

Just open terminal from system app launcher, and run command to create and edit a config file (replace gedit for other system):

sudo gedit /etc/apt/preferences.d/99mint-repository

In the case, I created a 99mint-repository file and added following lines:

# Allow upgrading only webapp-manager from Ulyssa repository
Package: webapp-manager
Pin: release n=ulyana
Pin-Priority: 500

# Also allow upgrading chromium (Added by another post).
Package: chromium
Pin: release n=ulyana
Pin-Priority: 500

# Never prefer other packages from the Ulyssa repository
Package: *
Pin: release n=ulyana
Pin-Priority: 1

As you can see, each entry has 3 lines (exclude the description line started with # at the beginning), and separated with a blank line.

The three lines started with Package: at the beginning specified the packages: “webapp-manager”, “chromium”, and “*” (everything).

About the “Pin: ” line:

The second line specifies the pin definition. It can be Pin: version 1.0.99*, the “*” is a “wildcard”, that says the package with all versions beginning with 1.0.99.

You can also use release or origin to specified package source. For example:

Pin: release o=LP-PPA-team-xbmc
Pin: release l=linuxmint
Pin: origin packages.linuxmint.com

The parameters for release are: a (archive), c (components), v (version), o (origin) and l (label).

And you can find out the values for release and origin by running command:

apt-cache policy |more

About the number of Pin-Priority:

The value of the third line can be set to:

  • 1000 or higher. Install a version from the target release even if it would replace (downgrade) an installed package with a higher version.
  • 990 to 999. Install a version even if it does not come from the target release, unless the installed version is more recent.
  • 500 to 899. Install a version unless there is a version available belonging to the target release or the installed version is more recent.
  • 100 to 499. Install a version unless there is a version available belonging to some other distribution or the installed version is more recent.
  • 1 to 99. Install a version only if there is no installed version of the package.
  • -1 or lower. Prevent the version from being installed

After setting up the config file, refresh system package cache via sudo apt update command and done.

Original Article

Related posts:

  1. Using PPA in Ubuntu Linux [Complete Guide]
  2. Ubuntu 17.04 "Zesty Zapus" All Flavors Download Links
  3. List of PPA Repositories for Ubuntu 17.04 Zesty Zapus
  4. Things to do After Installing Ubuntu 18.04
  5. Installing Packages From External Repositories in Ubuntu [Explained]
  6. How to List Installed Packages on Ubuntu and Debian [Quick Tip]
  7. How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions
  8. 16 Things to do After Installing Ubuntu 20.04
  9. Beginner’s Guide to Handle Various Update Related Errors in Ubuntu
  10. Troubleshooting “E: Unable to locate package” Error on Ubuntu [Beginner’s Tutorial]

Filed Under: Linux Tagged With: Package manager, Ubuntu (operating system)

Primary Sidebar

Trending

  • How to fix Windows Update Error 80244019
  • Windows 10 Update keeps failing with error 0x8007001f – 0x20006
  • How To Change Netflix Download Location In Windows 10
  • Troubleshoot Outlook “Not implemented” Unable to Send Email Error
  • How do I enable or disable Alt Gr key on Windows 10 keyboard
  • How To Install Android App APK on Samsung Tizen OS Device
  • 3 Ways To Open PST File Without Office Outlook In Windows 10
  • FIX: Windows Update error 0x800f0986
  • How to Retrieve Deleted Messages on Snapchat
  • Latest Samsung Galaxy Note 20 leak is a spec dump revealing key features
  • Install Android 7.0 Nougat ROM on Galaxy Core 2 SM-G355H
  • 192.168.1.1 Login, Admin Page, Username, Password | Wireless Router Settings
  • Websites to Watch Movies Online – 10+ Best Websites Without SignUp/Downloading
  • How to Backup SMS Messages on Your Android Smartphone
  • How to delete a blank page at the end of a Microsoft Word document
  • Fix: The Disc Image File Is Corrupted Error In Windows 10
  • Android 11 Custom ROM List – Unofficially Update Your Android Phone!
  • Samsung Galaxy Z Fold 3 could be scheduled for June 2021, with S Pen support

Footer

Tags

Amazon amazon prime amazon prime video Apple Application software epic games Galaxy Note 20 Galaxy S22 Plus Galaxy S22 Ultra Google Sheets headphones Huawei icloud Instagram instant gaming ip address iPhone iphone 12 iphone 13 iphone 13 pro max macOS Microsoft Microsoft Edge Mobile app office 365 outlook Pixel 6 Samsung Galaxy Samsung Galaxy Book 2 Pro 360 Samsung Galaxy Tab S8 Smartphone speedtest speed test teams tiktok Twitter vpn WhatsApp whatsapp web Windows 10 Windows 11 Changes Windows 11 Release Windows 11 Update Windows Subsystem For Android Windows 11 Xiaomi

Archives

  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org