Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Package Management: APT for RPM

Introduction

A few days ago, I post­ed an ar­ti­cle about pack­ag­ing, specif­i­cal­ly about us­ing check­in­stall to keep all your in­stalled soft­ware un­der at least some sort of man­age­men­t.

Now, I will talk about a set of tools to help you in­stall and unin­stall soft­ware eas­i­ly: APT.

Who should read this?

All you De­bian guys: you al­ready know APT, you are not go­ing to learn any­thing new here, so you can leave.

All the Gen­too guys: you use emerge (for some rea­son), you are not go­ing to like this, so you can leave, too.

This ar­ti­cle is ori­ent­ed to Red Hat user­s, Fe­do­ra User­s, and prob­a­bly users of oth­er RP­M-based dis­tros (but for them, the repos­i­to­ries are wrong, sor­ry!).

Why APT for RPM?

While the Red Hat and Fe­do­ra dis­tros work, the tools pro­vid­ed for pack­age man­age­ment suck. Sure, up­2­date work­s. Sure, RPM work­s. Sure sys­tem-­con­fig-­pack­ages work.

But:

  • sys­tem-­con­fig-­pack­ages is slow, is geared to stuff that came with the dis­tro, and pret­ty much sucks for any­thing else.
  • up­2­date sucks the same way, on­ly over the net­work (yes, I know you can set up your own up­2­date repos­i­to­ry).
  • RPM is too low lev­el, lack­ing any sort of de­pen­den­cy check­ing and be­ing ba­si­cal­ly ob­nox­ious.

The so­lu­tions are APT or yum. I like APT bet­ter, so there.

APT, the concept

APT works with the con­cept of repos­i­to­ries.

Sup­pose you want to use MPlay­er. It's a fine tool, but build­ing it from source to its full po­ten­tial is a chore, since it has about a tril­lion re­quire­ments, from win­dows codecs to ffm­peg to open­di­vx, to sdl, to aal­ib to what­ev­er.

So, how do you in­stall all those things in a ba­sic RPM sys­tem? You get each one from some­where (hope­ful­ly in pack­aged for­m) along with their match­ing -de­v­el pack­ages, and in­stall them. Then you build MPlay­er, and if you are luck­y, you did­n't for­get any­thing you may want to have next week.

But think about it: if MPlay­er was a RPM in­stead of a source pack­age, it would con­tain in­for­ma­tion about its re­quire­ments, right? That's one of the use­ful things about pack­ages.

What it won't have is in­for­ma­tion about where you can get those pack­ages, and RPM lacks the smarts to fig­ure it out.

So, what APT does is, you feed it a list of repos­i­to­ries, which are sim­ply web or ftp servers that have a col­lec­tion of pack­ages in them and some ex­tra files, so that if you down­load that data, you know:

  1. What pack­ages are in the repos­i­to­ry.
  2. What each pack­age re­quires
  3. What each pack­age pro­vides

So, us­ing APT, you tell it, "I want MPlay­er". APT knows MPlay­er is in the repos­i­to­ry (be­cause of item 1), knows what pack­ages should be in­stalled so that MPlay­er works right (item 2), knows how to get them (a­gain item 1), and so on.

Then, your com­put­er gets a whole lot of RPM files, in­stalls them, and you start watch­ing movies.

Getting APT

Ob­vi­ous­ly, there is one pack­age you just can't get over APT, which is APT it­self (at least the first time ;-).

There are sev­er­al places where you can down­load it, but I use freshrpms. Just fol­low the link for your ver­son of Red Hat or Fe­do­ra, and down­load the ap­t-xxxxx.i386.rpm file.

Once you have it, in­stall it us­ing RPM:

rpm -Uvh apt-xxxxx.i386.rpm

And that's that, you have APT in­stalled.

Using APT

The command line

The ba­sic us­age from the CLI is so sim­ple, if you have been in­stalling stuff us­ing bare RPM, you gonna want to kick your­self in the teeth

First, you need to tell APT to fetch the cur­rent list of pack­ages from the repos­i­to­ries. This has to be done ev­ery once in a while, since new pack­ages and new ver­sions ap­pear very of­ten. Nor­mal­ly, I just put it on a cron job at night.

apt-get update

Once you did that, if you want to in­stall a pack­age (say, MPlay­er)

apt-get install mplayer

Wait a lit­tle, an­swer any ques­tion­s, wait a lit­tle more, and that's it. If you al­ready have MPlay­er, but want to up­date it, it's the ex­act same thing as in­stalling it.

Up­dat­ing ev­ery­thing in your box? Well, there are two com­mands you can use:

apt-get upgrade

apt-get dist-upgrade

Should you use one or the oth­er? Well, dis­t-up­grade is smarter, and han­dles ma­jor up­grades bet­ter, but it's a lit­tle more prone to get­ting in­to con­flict­s. On the oth­er hand, up­grade some­times does­n't up­grade ev­ery­thing, and you need to up­grade a few pack­ages in­di­vid­u­al­ly lat­er (no big deal, any­way).

Just try it, you won't break your sys­tem, usu­al­ly.

But the above as­sumes you know what you want to in­stal­l. How can you know what is avail­able?

Well, you can look at the next sec­tion about us­ing a graph­i­cal tool, but here's a pro­pos­al: what do you want to do?

Do you want to play a DVD? Well, then just search for DVD in ap­t's data­base of pack­age repos­i­to­ries us­ing ap­t-­cache:

[root@roberto weblog]# apt-cache search dvd
a52dec - Library for decoding ATSC A/52 (aka AC-3) audio streams
a52dec-devel - Development header files and static library for liba52
gstreamer-plugins-extra-dvd - DVD plugins for GStreamer
libdvdcss-devel - Development files from the libdvdcss DVD decryption library
libdvdnav - DVD menu navigation library
libdvdnav-devel - Development files for the libdvdnav DVD menu navigation library
libdvdplay - Library designed for DVD navigation
libdvdplay-devel - Development files from the libdvdplay DVD navigation library
libdvdread - Library for reading DVD video disks
libdvdread-devel - Development files from the libdvdread library
ogle - DVD player that supports DVD menus
ogle_gui - Graphical user interface for the ogle DVD player
perl-Video-DVDRip - Graphical DVD ripping tool based on transcode
subtitleripper - DVD subtitle ripper
transcode - Linux video stream processing utility
videolan-client - The VideoLAN client, also a very good standalone video player
videolan-client-devel - Header files and static library from the Videolan Client
xine - Free multimedia player
xine-lib - Core library of the xine multimedia player
xine-lib-devel - Development files for the xine library
dvd+rw-tools - Toolchain to master DVD+RW/+R media
radvd - A Router Advertisement daemon
gstreamer-plugins - GStreamer Streaming-media framework plugins
k3b - CD/DVD burning application for KDE
libdvdcss - A portable abstraction library for DVD decryption.
cdrecord - A command line CD/DVD recording program.
dvdrecord - A command line CD/DVD recording program.
libpostproc - Video postprocessing library from MPlayer.
kaffeine - A xine-based Media Player for KDE
mplayer - MPlayer, the Movie Player for Linux.

As you can see, you get a list of pack­ages that seem re­lat­ed to the search ter­m. Since each pack­age has to con­tain a de­scrip­tion, one would ex­pect all these are some­what re­lat­ed to DVD­s.

Want more de­tails on one of them? As for it!

[root@roberto weblog]# apt-cache show kaffeine
Package: kaffeine
Section: Applications/Multimedia
Installed Size: 2400
Maintainer: kde-redhat Developers <http://kde-redhat.sf.net/>
Version: 0:0.4.3-0.0.b.2
Pre-Depends: rpmlib(CompressedFileNames) (<= 3.0.4-1),
rpmlib(PartialHardlinkSets) (<= 4.0.4-1),
rpmlib(PayloadFilesHavePrefix) (<= 4.0-1),
rpmlib(VersionedDependencies) (<= 3.0.3-1)
Depends: kdelibs (>= 6:3.2), libDCOP.so.4, libICE.so.6,
libSM.so.6, libX11.so.6, libXext.so.6, libXrender.so.1,
libXtst.so.6, libXv.so.1, libc.so.6, libc.so.6(GLIBC_2.0),
libc.so.6(GLIBC_2.1.3), libdl.so.2, libgcc_s.so.1,
libkdecore.so.4, libkdefx.so.4, libkdeprint.so.4,
libkdesu.so.4, libkdeui.so.4, libkio.so.4,
libkparts.so.2, libm.so.6, libm.so.6(GLIBC_2.0),
libnsl.so.1, libpng12.so.0, libpthread.so.0,
libpthread.so.0(GLIBC_2.0), libqt-mt.so.3, libresolv.so.2,
libselinux.so.1, libstdc++.so.5, libstdc++.so.5(CXXABI_1.2),
libstdc++.so.5(GLIBCPP_3.2), libutil.so.1, libxine.so.1,
libz.so.1, qt (>= 1:3.3)
Provides: libkaffeinepart.so, kaffeine (= 0:0.4.3-0.0.b.2)
Obsoletes: kaffeine-plugin (< 0:0.4.3)
Architecture: i386
Size: 1
MD5Sum:
Filename:
Description: A xine-based Media Player for KDE
 Kaffeine is a xine based media player for KDE3. It plays back CDs,
 DVDs, and VCDs. It also decodes multimedia files like AVI, MOV, WMV,
 and MP3 from local disk drives, and displays multimedia streamed over
 the Internet. It interprets many of the most common multimedia formats
 available - and some of the most uncommon formats, too. Additionally,
 Kaffeine is fully integrated in KDE3, it supports Drag and Drop and
 provides an editable playlist, a bookmark system, OSD and much more.

Ok, ig­nore the stuf about the de­pen­den­cies and con­cen­trate on the de­scrip­tion. That's what I said I want­ed right? Then I should in­stall it.

The graphic way

There are sev­er­al graph­ic fron­tends for APT. The one I am more fa­mil­iar with is synap­tic.

You can in­stall it from the com­mand line:

apt-get install synaptic

And just use it. It is sup­posed to be in­tu­itive, so that's all I'm gonna say about it.

Conflicts

What's a con­flic­t? Imag­ine pack­age A re­quires li­brary L ver­sion 1. And Pack­age B re­quires li­brary L ver­sion 2, and you can't have both ver­sions in­stalled.

If your repos­i­to­ries con­tain A, B, L1 and L2, when you in­stall B, if you had A al­ready in­stalled, APT will re­move A and L1. It will ask you first, so you should re­al­ly read care­ful­ly when­ev­er APT tells you that it will re­move pack­ages.

In any case, it's not so ter­ri­ble, be­cause you can al­ways just in­stall A again, which will re­move B and L2 ;-)

There are some oth­er forms of con­flic­t, and some oth­er ways that APT can fail. For ex­am­ple, if you once in­stalled a pack­age with­out its de­pen­den­cies by us­ing the --n­odeps switch for RPM (y­ou should­n't), APT will not like it.

If you have two ver­sions of the same pro­gram in­stalled, APT will not like it.

APT Repositories

Your APT is on­ly as good as your repos­i­to­ries. If you have a lame set of re­pos, your APT is an ig­no­rant tool that on­ly knows how to in­stall xbil­l.

Ok, it's some­what bet­ter than that, since the APT pack­age freshrpms pro­vides in­cludes a set of repos­i­to­ries al­ready set for you. But that's just the be­gin­ning.

Picking up repos

You can add a repos­i­to­ry in the /etc/ap­t/­sources.list file, but I don't rec­om­mend it. A bet­ter idea is this:

For each difer­ent repos­i­to­ry you want to use, cre­ate a file in /etc/ap­t/­sources.list.d. For ex­am­ple, to use the DAG repos­i­to­ry, I would cre­ate /etc/ap­t/­sources.list.d/dag.list (the .list ex­ten­sion is re­quired).

Lat­er, if I want to stop us­ing it, I can just re­name it some­thing else, or even delete the file. And that way, you don't have to ed­it a sin­gle file with a lot of garbage.

But what goes in that file?

Source lines. Here's an ex­am­ple (my dag.list file, in fac­t):

# Dag RPM Repository for Fedora Core 2
rpm http://apt.sw.be fedora/2/en/i386 dag

The line start­ing with # is a com­men­t, so no big­gie. The sec­ond line is the im­por­tant thing.

  • RPM means this line is about RPM pack­ages (as op­po­site to a rp­m-s­rc line, for ex­am­ple)
  • http://ap­t.sw.be is the web­serv­er hold­ing the repos­i­to­ry
  • fe­do­ra/2/en/i386 is the di­rec­to­ry in­side the serv­er that con­tains pack­ages for your dis­tro (Fe­do­ra core 2 in this case)
  • dag is the repos­i­to­ry to be used. Some servers con­tain sev­er­al repos­i­to­ries. In those cas­es you can use sev­er­al lines (one for each), or you can put sev­er­al in the same line, for ex­am­ple:
rpm http://ayo.freshrpms.net fedora/linux/2/i386 core updates freshrpms

That us­es the core up­dates and freshrpms repos­i­to­ries from the same serv­er. Of­ten, a repos­i­to­ry will have sep­a­rate repos­i­to­ries for sta­ble and un­sta­ble soft­ware, or for base sys­tem and ex­tras, or for base and up­dates. It varies from serv­er to serv­er.

No­tice how the path and repos­i­to­ry names are dif­fer­ent in the two ex­am­ples. That is be­cause it's a func­tion of where the RPMs are stored in the server, you can't just make up any stuff you wan­t.

To put it sim­ply: you need to find, for each repos­i­to­ry you want to use, what the source lines are.

Nor­mal­ly, that means a vis­it to the repos­i­to­ry's web­site, and look around a lit­tle. Be very care­ful to use the repos­i­to­ry match­ing your dis­tro, or weird stuff may hap­pen. Like, say, up­grad­ing your dis­tro from Man­drake 10.1 to Red Hat 7.3 ;-)

Some repos for you

So, here's some nice repos­i­to­ries you can try. Us­ing these repos­i­to­ries should not cause con­flict­s.

These are al­so cool, but they may cause con­flicts more of­ten than lim­it­ing your­self to the first set.

Final words

Hope you en­joyed the ar­ti­cle. If you did, there's more in the Ar­ti­cles sec­tion of the site.

If you have any doubt or ques­tion about any of this, just post a com­ment or email me. The best thing is prob­a­bly to post a com­ment and email me telling me you post­ed it

Did you like the heavy link­ing in this ar­ti­cle? Let me know so I can fig­ure out if I will do it again.

Roberto Alsina / 2006-04-04 16:32:

Comments for this story are here:

http://www.haloscan.com/com...

??? / 2006-09-30 08:20:

sorry ok

employment background check / 2011-12-27 23:24:


Hi very nice article


Contents © 2000-2023 Roberto Alsina