Flipping the Linux switch: Package management 101
Your shiny new Linux system has it all -- except that one program you really needed it to install. You get online, you find the program's website, and click 'download'. Except there's not just a link to the program there. There are four, or five, or more links to the program. Each has a slightly different format, ending with .rpm, .deb, .tgz, or possibly even .ebuild.
Some include x86 in the name, while others say ppc or amd64. What's the difference? What's actually included in these packages?
Packages are pre-compiled programs for your system (the exception being Gentoo's .ebuild). You've got to know a bit about your system to install them.
It's not enough to know just that you need an .rpm or .deb. You should know your computer's architecture (32 or 64 bit chip? PowerPC?), as well as the architecture of the distribution you installed. Don't panic if you have a 64 bit chip and installed an x86 distribution (backwards compatibility is a good thing), but keep in mind you'll have to install x86 packages. It's best to use a package labeled for your distribution, though in some cases it is possible to install packages across similar Linux systems. For instance, many Slackware packages are able to install on Zenwalk.
Package management refers to the way your distribution installs and configures (as well as manages and removes) software applications and libraries on your system. When Windows installs an .exe (which is the closest thing in Windows to a package) it usually places it in a single specific place within a directory. Linux installs across a few directories, leaving many new Linux users scratching their heads as to where their .rpm actually went. Most distributions install the executables in /usr/bin, and the libraries in /usr/lib. You may notice related files in /usr/share or /etc.
Fear not, brave user. Package management systems have front-ends that make installing and removing packages easy. For instance, dpkg installs .deb files, and apt (or a graphical installer front-end to apt like Synaptic) can be used to not only install the program in question, but any underlying programs it might require to run (called dependencies). For .rpm files there is YUM, with graphical front-ends like Pirut or KYum. Slackware has swaret that uses the installpkg command set. Gentoo has portage and the emerge command. All of the aforementioned front-ends handle dependencies, which can save you loads of frustration (and keep you from descending into dependency hell).
Package management systems call upon your distribution's software repositories to add programs, as well as keep track of anything you have installed. This is how it can calculate dependencies and hopefully help resolve them. If the dependency can't be resolved (if two programs require dependencies that can't co-exist on a system, for instance), the front-end will inform you of this so you can decide what to do.
So what about installing that critical missing piece of software? Let's take a look at the process using Synaptic. YUM front ends work similarly. Slackware's swaret and Gentoo's portage are command-line based, but commands and configuration are well documented.
Upon opening Synaptic (or any application that installs programs) you are asked for the root password (in Ubuntu, this is your user password, as Ubuntu handles the root account differently). We need not remind you that root powers are not to be used lightly, and to only add trusted sources to your repositories.
When Synaptic opens, you can use filters to explore various packages on the system, including upgraded packages and installed packages. Here we see all available packages.

We press the reload button, so that the latest changes to the repository are registered. Then we search for the package we are so sorely lacking.

We select the package for installation. This is where the magic happens. Our system is scrutinized by apt, and Synaptic tells us that we don't have a lot of the dependencies we need. Since we really need this program, and there are no conflicts, we tell Synaptic to apply the changes.


Synaptic begins downloading from the available repositories. Once it's done downloading, the install process begins. In this case, the downloading took about four minutes, and the install took less than eight seconds. Here we can see the completed install process with a little feedback from apt about what it's doing.

And we're in business with our newly installed (and extremely critical) application.

Package management systems are often a source of confusion for new Linux users, but they're essential to keeping your system up to date and working the way you want. Fortunately, through the use of front-ends and installers, it's easy to build a system that's lean and fast, performs a specific task, or simply takes care of itself.













Comments
36
Subscribe to commentsPatrikJan 9th 2008 6:43AM
This is the reason why I will never use Linux...
rulskyJan 9th 2008 7:47AM
This is the reason I use Linux....
Ubuntu Gutsy 7.10
SeanJan 9th 2008 8:43AM
You know, that sounds just damned lazy
No personal offense meant, bub
ZachJan 9th 2008 8:11AM
Is it really that difficult to have one universal package that will work with all distro's? I can't tell you how frustrating it is to want to go to a website and download the latest version of a piece of software only to have to compile that latest version of a piece of software I want to use because they don't offer a package for my distro.
Karl O. PincJan 14th 2008 1:09PM
Zach said: "Is it really that difficult to have one universal package that will work with all distro's?"
Yes. It's approximately as difficult as having one universal package that will work on Macs, Microsoft Windows 3.2, 98, ME, XP, and Vista, SunOS, IBM mainframes, and your cell phone.
If you need to install software that does not come with your Linux distribution then either become an expert or pick another Linux distribution. The nice thing about Linux is that you actually _have_ these 2 options available.
SeanJan 9th 2008 8:44AM
Linux ... switch ... wooo, I wish it was so simple as a toggle-button ;^)> but then you wouldn't learn so much, on the way there, riiiiiight?
You know, package management is also about the way in which a Linux distributor creates and manages individual software packages, for individual distributions, on individual architectures, and the way in which a systems administrator may endeavor to create packages from locally managed "stuff".
I'd say that Debian has it down, pretty damned well, at that -- on all counts, there. It ain't just about bias, either. They have a thoroughly solid packaging system.
Adios, muchachos e muchachas
JEBBJan 9th 2008 8:40AM
I have been trying to figure out Ubuntu to see if I might want to move to it from MacOSX. Just to do it, I downloaded and installed a program that was not in a repository. After doing that I installed a link to it in the Applications menu. It took a month to sufficiently understand the logic of the process and to figure out what I needed to do. At this point I'm pretty sure I've since forgotten the steps involved. Until such processes are simplified, it's just not going to be a main stream tool.
StrapsJan 9th 2008 8:40AM
I can format and install a new version of Ubuntu in 1 hour, including programs using a single apt-get command...
Creating a dedicated /home partition, all of my personal settings remains there...(mail, firefox ext, ...)
With Ubuntu Gutsy 7.10, if you type a program name that is not installed, it suggest you the package to install to use that program...
I call it simple...
Paul in SFJan 9th 2008 11:13AM
"Frank Zhao said...
You click on Synaptic, search for the name of the program you need, check mark it, it'll then automatically find everything else you need, click apply and you are done, whats so hard about that?"
That is what the article should have said. I've been using Linux for about 3 years now, but my eyes still started glazing over about 2 paragraphs into this article.
I had been reading it to see if it was something I wanted to forward on to my friends who I have introduced to Linux. Non-technical types these are, who moved away from Windows at my urging about a year ago, thus far with no problems. No way will I send this to them.
Kristin ShoemakerJan 9th 2008 11:54AM
Paul... I had some concerns myself with this piece. Frankly, there was a fine line I had to walk... and a decision that had to be made. Do I cover all the package management systems, or do I just deal with Debian and Red Hat based systems? Certainly, a good deal of new Linux users start with one or the other.
It didn't sit right with me to slight Slackware or Gentoo (or any of their offshoots). And frankly, people do run into .tgz and .ebuild files on occasion, when they look outside their repositories for a package. They wonder what they are. So I decided to cover them.
Would it have been better to just walk through an install with, say, Synaptic and Pirut or Yast? Maybe. Certainly you can use these installers without having any idea about the underlying mechanisms. And that's fine, there's absolutely nothing wrong with that.
Some people are curious as to where their rpm goes, and what's going on. That's fine too.
I do hope I shed some light on the internal workings for those who were curious about what went on under the hood, not just in their chosen distro, but the others out there.
Package management a fairly complicated subject, with a number of really elegant solutions that make it simple to the end user.
BuddhikaJan 9th 2008 1:33PM
What's so hard about package management in Linux ? If someone new to computers started with Linux he will see .exes as weird.
PhixionJan 9th 2008 1:55PM
*yawn* are people STILL blogging about Linux.
This isn't a new discovery you know... The fact is that Windows will always remain #1 choice for most users, "geek" or not. The fact that I can do ANYTHING on my Windows machine is good enough for me, I simply don't have the time to spend hours and hours trying to get simple things up and running, I like to play games when I want, not sit there trying to get the thing working through WINE/CEDEGA, which, if I'm lucky, will give me ~50% lower performance in most games.
If you're not a complete noob you aren't going to end up with Viruses and Spyware on Windows, even if you don't run a Firewall or Spyware protection. It's all about knowing what *not* to click on.
Jimmy the chipJan 9th 2008 4:50PM
People thought the steam engine enabled you to do ANYTHING. No need to bother with a jet engine then.
Blunt and tenuous analogy, I know, but the idea that you might not know quite enough about what you are missing stands.
Games are a big problem on non-windows platforms. And before people tell me there are plenty of great games on linux - frozen bubble is not the crysis-clone I have been looking for.
BTW, my experience of wine and the cvs form of cedaga tends to run the games that do run better than vista.
Phixion;
"If you're not a complete noob you aren't going to end up with Viruses and Spyware on Windows, even if you don't run a Firewall or Spyware protection. It's all about knowing what *not* to click on."
Not as true as you might think.
http://tinyurl.com/2u874g
If you had any knowledge of remote exploits, you might not be quite so condescending and smug :P
Paul in SFJan 9th 2008 2:09PM
"Kristin Shoemaker said...
Paul... I had some concerns myself with this piece. Frankly, there was a fine line I had to walk..."
Kristin, you did walk it just fine. I think that my comment sounded harsher than I meant it to be. Your article is fine for its intended audience. I had just hoped for something more basic, that I and my newbie friends might more easily relate to.
Kristin ShoemakerJan 9th 2008 2:40PM
No worries, Paul. I've been using Linux about seven years now, and it's still a difficult sort of concept to explain. Each packaging system is slightly different, and has different layers that can be quite complex... And the actual management of it all is so *simple*.
I have a good healthy dose of "what does this button do" in me... So I am the type of person who had to find out, in the beginning, where the heck the packages were actually going.
I know I'm not the only one... it draws a lot of people to Linux. It also turns a lot of people off Linux... when it really doesn't have to anymore. It's kind of a funny situation. I find updating my Linux system much easier than keeping my husband's Windows box up to date...
dsstdfJan 9th 2008 2:46PM
To each his own, I sit at a Mac and feel like I'm lost, sit at an xp box and feel like "wow this feels old", sit at a Vista machine and feel like its slow and cumbersome. I chose Linux for two main reasons, first its price. While Xp might only cost a hundred bucks, I have 5 computers in my house and it adds up fast. The second is open source, paying for software or pirating it is out of the question. I've been a geek for 15 years now and I have yet to call Microsoft for "tech support" (except for a failed install authentication for a copy of xp I OWNED). If you have enough brains to Google your problem, you can fix almost any issue you will come across in Linux.