Hot on HuffPost Tech:

See More Stories
Free Switched iPhone app - try it now!
AOL Tech

Flipping the Linux switch: Package management 101

Synaptic Package ManagerYour 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.

Tags: apt, deb, ebuild, how to, HowTo, howtos, install, Linux, linux-switch, opensource, osupdates, package management, PackageManagement, portage, rpm, Synaptic, yum

Comments

36