[Howto] Install packages from a conflicting repository

Write tutorials and howtos in here
More tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please, Before you post please read this

[Howto] Install packages from a conflicting repository

Postby chinoto on Wed May 02, 2012 12:10 am

If the package you want to install isn't part of an apt repository, use this howto instead: viewtopic.php?f=197&t=99465
By conflicting repository, I mean has packages that also exist in other repositories you use, otherwise just drop it in sources.list and that's it.

Thanks to hactar on IRC for reminding me about the existence of apt preferences, I realized I didn't have to make a local repository for individual packages (still like it for heimdall and frostwire though). Unfortunately I ran into the problem "how does this even work?!?". (Pretty well figured out now :D)

MEPIS is used for examples because it should be completely compatible with Debian, has a huge repository (seems likely to be problematic but isn't), and I needed it for Wine.

Unlike my previous method this way doesn't require you to manually download packages and is less hassle to setup and use. So here we go.


==Installing packages from a conflicting repository==
1. Get the source line for the repository the package(s) are in.
looks like "deb address distro [component ...]"; eg "deb http://main.mepis-deb.org/mepiscr/testrepo/ mepis11cr test"
2. Open an editor as root: [gksu|kdesu|sudo] [gedit|pluma|kate|mousepad|leafpad|nano|joe] (eg gksu gedit)
3. Open /etc/apt/sources.list and on a new line put in the repository's source line from step 1, save and close this file.
4. Open /etc/apt/preferences and add in
Code: Select all
Package: *
Pin: origin ORIGIN
Pin-Priority: 1

#Use for packages you want
Package: firefox
Pin: origin ORIGIN
Pin-Priority: 800

Replace ORIGIN with the (sub)domain of the repository for example http://main.mepis-deb.org/mepiscr/testrepo/ would be main.mepis-deb.org
5. Reload the package manager in some way (eg "sudo apt-get update")
6. Install the packages in your preferred way (eg "sudo apt-get install PACKAGE")
---- ---- ---- ----
Example additions to /etc/apt/sources.list and /etc/apt/preferences:
Code: Select all
deb http://main.mepis-deb.org/mepiscr/testrepo/ mepis11cr test

Code: Select all
Package: *
Pin: origin main.mepis-deb.org
Pin-Priority: 1

#Sets the priority of all packages with specified name to 800, installs the one with alphanumerically higher version
Package: wine firefox thunderbird
Pin: version /.*/
Pin-Priority: 800


==Notes==
The special sudos are mainly for when you run a command without a terminal (Alt+F2 in Gnome)
kdesudo is for KDE, gksudo is for gtk DEs such as Gnome and probably LXDE and xfce
New: I found a shortcut in the menu for "Root Terminal" which uses gksu, apparently with gksu you can set it to save your password for the session,
__ so I've changed the howto to use that instead. (I find it rather convenient, especially for things I use a lot like gparted :))
---- ---- ---- ----
if (Priority==1) {packages affected by the pin can only be installed:
__if they are unique OR if it solves a dependency that other origins can't}
So if your package doesn't fall into either category then you'll have to specify the package version yourself
apt-get: Check "apt-cache madison PACKAGE" to see what versions are available,
__(if it fails use "apt-cache show PACKAGE | egrep 'Package|Version'")
__then do "sudo apt-get install PACKAGE=VERSION" (eg firefox=12.0+build1-0mcr110+1)
Synaptic: Select the package, go to "Menu>Package>Force Version" (Ctrl+E), proceed as usual
---- ---- ---- ----
Regex pinning is a VERY recent addition: http://juliank.wordpress.com/2011/04/15 ... -triaging/
---- ---- ---- ----
In Synaptic, the Origin categories show packages that only exist in that origin or has a priority that overrides another package,
so although mepis may have a ton of packages, you only see some of them (most of which are Firefox and Thunderbird translations)
---- ---- ---- ----
Priority meanings: (assuming they are obeyed at all...)
Code: Select all
    P<0     =prevents the instance from being installed
    P=0     =supposedly defined in the next line, but doesn't behave that way
_0<=P<=100  =causes an instance to be installed only if there is no installed instance of the package
100<P<=500  =causes an instance to be installed unless there is an instance available belonging to
             some other distribution or the installed version is more recent
500<P<=990  =causes an instance to be installed unless there is an instance available belonging to
             the target release or the installed version is more recent
990<P<=1000 =causes an instance to be installed even if it does not come from the target release,
             unless the installed instance is more recent
1000<P      =causes an instance to be installed even if this constitutes a downgrade of the package
chinoto
Level 1
Level 1
 
Posts: 16
Joined: Thu Apr 12, 2012 9:09 am

Linux Mint is funded by ads and donations.
 

Return to Tutorials / Howtos

Who is online

Users browsing this forum: No registered users and 6 guests