Also acta

Debian Squeeze with OpenBox

Debian GNU/Linux - Squeeze with OpenBox
If you can walk and chew gum at the same time, you can run GNU/Linux

debian tutorials
debiantutorials.org is built on and runs on Debian.

 

Creative Commons License
Manage Debian System Software
Managing Your Debian System Software Print E-mail
Written by machiner   
Sunday, 22 February 2009 11:13

EDITI just made a little video0 of a quick package installation using aptitudea. Those using Debian and its package management schemes can't say enough about how sweet it really is /EDIT

Pre-Goods Rant



It's not easy to please Humans.  Most of us demand gold if we are to give up our tin and have many other unreasonable expectations of things.  It's usually from all the lines of BS that we hear.  Our heads get filled with fantasy and it's pretty attractive, a damn site more attractive than what we've already got.  For example when some kid tells you that his car is better than yours.  Or, his computer never gives him trouble, or - I can do this...can you?

We spend a lot of time demanding that the grass be greener if we're to leave our current pastures. The funny thing is, that if we look down, we usually see bright green grass. Somehow it's not green enough, though. Or, and this is the killer to me, a person may refuse to leave their cherished pasture even though the grass is wilted and brown for fear of stepping into another, worse, pasture. Or, even the fear that it will be better, but we fear success. We're nervous like that. Moreover, we're very subject to perception in sometimes reckless ways. This explains why we think that Windows is a decent operating system and Linux is hard.

One of the things I hear all of the time is that it's "so hard" to install new software on Linux. Honest, that's what I hear. I know, it's pretty funny. Moreover, it's not true at all. It's a lot harder to install software on Windows simply because the whole event, including running newly installed software, can wreak havoc on the OS. It's not enough just to double-click on super-ultra-mega.exe, no. That install program spiders itself throughout your system and more often than not, with your batch of 4 installs, and the course of a month or 3, your machine is barfing and refusing to budge. Worst case scenario, ya - but it happens. A lot. Even though the actual act of double-clicking is pretty simple, the results of that double-click can, and often do, bit you right on the butt.

But...

There are about 400 gazillion apps for Windows. Some of them are pretty good, too. It must be hard for win32 developers to make their wares with all the idiosyncratic demands they must meet in order to make a thing work in Windows. Windows likes to do things its own way -- even tough there are loud voices calling for a standardization of Linux programs that they can be installed in a very simple fashion no matter the distribution, Linux based software, open source software is, in fact, based upon globally regarded standards - and - being open source means that they get to use other people's "objects" within their software. So, regardless of the "standardization" of open source software across distributions, the only thing standard about software on your Windows box is the double-click. Regardless of msi software for Windows is all over the place. Like what happens when you install it to your machine.

Linux has a sort of mess, too. But it's in the delivery. For example there are software packages that come to us in tar.gz packages, bin packages, java, python, deb packages, rpm packages, etc., etc., etc. It's just a package, though. All of them are containers and all of them are quite simple to install, but not yet.

Debian Package Management

One of the big draws to Debian, the biggest probably, because it is so damned righteous, is its package management system. Its function is one of those things that, when used, may have you wondering why every OS in the world doesn't have this functionality. Well, most Linux distributions do, not Debian's, per say, but something centralized at least. Consider this for a moment: An OS released as an all-encompassing system with the kernel, its utilities, and an array of productivity and playtime software that will keep you busy and efficient until you can't type (or click) anymore. That's cool. Moreover, this collection of software that makes up the distribution is manageable by clicking a program from your menu, or running the command in your terminal.

Not only does a centralized package management system save you days and days of searching the net for functionality that you (need), another helpful and certainly calming feature is that all of the software released together as this distribution has been tested, tweaked, inspected, detected and designed to function perfectly with the kernel and all the other software in the package. lol, try that one time with your Windows and your shareware. I kid, don't - really.

Think about that one time because I know you can appreciate it, thinking person that you are; and not completely subject to drooling fits upon seeing shiny metal objects. All the software you will probably ever need is centralized, designed to function properly together, virus free, and right there at your fingertips. You can't buy that kind of functionality. And you don't have to - Debian is free, and so is all that software in your repository 1.

There is an issue, though, and it throws some people. The thing is, even though this is all centralized and magnificent, the open source world is a little crazy in that there are typically myriad ways to accomplish a thing. Package management is no different. There are many command line apps and GUI apps that you can use to manage your software. Thankfully (to some ;)) the default installation of Debian has only 2 in the main menu: Add/remove Software and the Synaptic package manager. These are not what I use, but they are terrific programs and take any guesswork out of managing your software. You should use them until you're savy enough to use other methods.

The real utility doing all the work is dpkg. People don't use it a lot because to do so requires one to fire-up a terminal, become root, and have at it. It's not at all difficult, but it's not pretty either and there are no buttons to press to make it brain-dead simple. Lol, instead, there are links to press and confuse you. Relax, though. The open source world knows your plight and many have set out to make the default package manager in Debian (dpkg) friendlier and complete with buttons for your pleasure. Take Synaptic. It's a front-end to apt, which is a front end to dpkg. Oof, I know - but don't let it bother you. Think of it as Blue on Monday, green on Thursday, etc., etc., etc.

Synaptic is a well thought-out GUI front-end to Debian's own apt package management system and it's terrifically simple to use. In fact, if I wrote out a how-to you'd be annoyed that I was writing "down" to you - it's that simple. Basic function: search your program by description if you don't know its name, mark to install (or remove) it, click install, OK it one more time, and there ya go. Done deal: fast, reliable...centralized. Have a look...

synaptic package manager

The other GUI "package manager" (or, front-end) installed on a default Debian Lenny system is the Add/Remove Applications utility. Have a look...

add/remove applications

It was made to placate nervous ex-Windows users or tentative Linux dabblers. I'm not fond of it because it lists apps that are part of meta-packages as separate entities and when you goto remove one such app the program tells you that you must remove all the other parts of that meta-package as well. That's cool because it keeps things neat and tidy, but I would prefer if that part of the meta-package weren't listed separately at all. Synaptic doesn't list these things separately. For example, gfloppy is listed separately in the Add/Remove Applications utility but when searched by description in Synaptic, gnome-utilities is returned as the result. I think that in attempting to placate Windows users they have caused a little confusion. In making things "easy" they have introduced more confusion into the mix. Personally, I don't use any of these apps :)

Confusion

Phew! With all the programs available to manage your systems packages (software) you are bound to become confused or run into trouble. Ya? Maybe. The trick is to use one program and stick to it. For example, apt (the ugly back-end for Synapttic) is a very popular command line package manager on Debian. It's terrific, no doubt, but it doesn't jive with aptitude. Huh!? What happened to dpkg? WTF is aptitude? OMG, someone just mentioned gdebi, too. Whaaaaa!?

Relax. Remember, all these GUI apps are simply front ends to the real back-end utilities, of which there is only one, with two alternatives. I don't know much about Add/Remove Applications, though. Could be a front-end, could be an entity unto itself. You tell me. Gdebi is simply a .deb package installer. Windows like double-click action for a deb container that you could call an exe file. If you wanted to associate it thus.

The Real Deal

There are a lot more GUI package management front-ends you could use, too. They all have their features and their quirks, like any piece of software, but if you really want to utilize and efficient and righteous package management app on Debian you'd use aptitude. It's not pretty and there are no buttons to push. However, it's fast, efficient and "official". It keeps stellar track of what's installed and what's been removed. It keeps an easily accessible log of its actions, too, which can be pretty handy for a lot of reasons. Mostly, it just rocks and is about bullet-proof. Have a look at its righteous purity...

Pretty horrific, huh? Yeah - it's an ugly beast to some, me included. Moreover, it's a little confusing initially but if you give it some effort -- oh, baby, that's functionality. Thankfully, you don't have to use Aptitude in this manner. You can run Aptitude with arguments right from the command line like this: aptitude install coolness, or aptitude --without-recommends install coolness, or aptitude remove wasn't-cool-at-all. Sure, you can do a lot more with it, but for the purposes of installing, removing, upgrading, the 15 seconds you spend hitting up-arrow in your root terminal is time well spent.

But...that's not what we're here to talk about

We're here to dispel the tired-old-BS that installing apps in Debian (or other Linux distros) is a hard thing. I begin to lose my patience with all the loud people out there spreading this myth. Why do we listen so intently to rabid, ignorant 10-year-olds? The perceived difficulty in installing apps in Debian stems from 2 things:

  • People are generally damned lazy, resistant to change or new ideas (how'd we evolve?)
  • New things excite us and cause apprehension concurrently - bad medicine

If you run Debian and its 23000 strong collection of software isn't enough for you, you're in luck. You can install software that doesn't come with Debian. Simplest thing in the world. Or, if you need version 2.33 of X program and Debian's repositories only have version 2.31, you can generally install that .33 version in a couple of ways.

Debian has 3 (4, really, but the 4th is too spooky for you ;)) branches of its Operating System. Stable, testing, and unstable (Sid, that bastard). Stable release is tried and true completely rockin' software that is usually a few months old. lol, back in the day a thing that was 2 months old wasn't even broken-in yet! Still, some updates to software that include new features won't make it into Debian's stable, or release, branch. That branch only gets security updates and periodic release updates to include major bug fixes. Testing or unstable may have the version you want and it's a file change away from being available to you 2. Or...

You may also find a newer version online at the developer's web site. Or another location. And this is where people panic. DON'T PANIC!! I know it was a great leap of faith for you to embrace, or at least try, Debian methodology. It's night and day from Windows. But you've come this far - no need to give up now. Installing that version you found online is cake, it's simply not as cake as firing up a terminal and aptituding your way to software nirvana. Let's see about how files online are packaged-up and then installed on your sweet Debian Lenny box.

.tar.gz Files

clearly the most common and popular form of delivering software to you aside from Debian's own .deb package management system. A tar.gz file is simply an archive. A zip file. In the container is what's needed in order to build that software in a fashion customized for your machine. Now hold on. "Building" doesn't mean that you're responsible for handling code. No way. It merely entails performing 3 very simple steps in order to allow your system to do all the work.

Within the tar.gz archive (container...whatever) are the files necessary to build on your machine. There are configuration files and .c files and all that happy nonsense and if you start peeking into all the files you will lose your mind. So, don't. It's not at all required. What is required is a terminal, your fingers or other typing device (see, I'm not a completely insensitive bastard) and a couple simple commands. Wicked easy - my little girl compiled software when she was 6.

Let's run through a typical compile so you can see how simple it really is. And, as a bonus, if you're any kind of a geek, it's pretty cool to see the thing build itself. Just for you.

You've got the file downloaded and you know just where it is, 'cause you're tidy like that. Now, you can either do all of this from the terminal or just some of it. Let's just do some of it this time. We can open Nautilus (our handy file manager in the default Debian Gnome installation) and goto the folder that contains the download. Find the download in that directory - here's a tip - after Nautilus opens and you're in that directory, just type the first couple letters (yes, into "thin air") of the file name and you might just see Nautilus bring you right to it. Way cool. When you locate the file, just double-click it. Your archive manager will open and show you the container's contents. Simply extract the guts to its own directory. Handier, still, is a right-click function of "extract here". Not part of Nautilus by default so download, extract, and add this to your /home/.gnome2/nautilus-scripts directory.

After it's extracted (un-zipped) you can go into that directory and get to work. We need the terminal now, though, so fire it up. In it, let's goto that directory:

$ cd /that/extracted/directory

Now we can get busy. We need to perform 3 steps to compile this software thus installing it and enjoying its functionality. First up, we configure the package to our system. Yo do it like this:

$ ./configure

Simple enough, ey? There is a configure file within the extracted files that will perform a check on your machine ensuring that all necessary "dependencies" that are required for the program to work - or, to enable special functionality, are installed. If no, you will be notified with exactly what's missing.

If your system doesn't meet the basic requirements necessary to install this software then you must either disable certain functions of the software before configuring it, or you must install the needed dependencies. This is where aptitude and the like shine, but since we're building this bad-boy ourselves, we must manually install dependencies. Which, is not hard at all - just time consuming. However, for today's purposes, all the dependencies are met and you're good to go.

After you ./configure the software it's ready to be "made". It will build itself per your configuration instructions or you can just let it build itself as it will, again, to your machine. Are you ready to make it? OK, take deep breath, prepare....

Type make at your prompt. $ make Make is the 2nd command out of 3 and it takes the longest. Days even if you're "making" something big like Gnome on a slow machine. But, don't worry, make usually takes just a minute. What happens is, the software builds itself against what you've got for hardware and software already. It's very cool and custom. It takes your configuration instructions (or defaults) and runs with them. Again, if there are problems, you will be notified.

After make runs your software is ready for installing. Cool. See how easy it was so far? It's not going to get any harder. Now, in order to perform system commands on your Debian (Linux in general) system you will need to become "root", or the "admin". One giant reason Linux is safe from viruses is because the system does not allow regular users any control of system resources. Installing software is a system function and you don't have that kind of permission. So, become root in your terminal like this: $ su. After you input the correct root password, and hit enter, you will see that your $ prompt is now a #. It's telling you that you are root - on your toes, man!

Being that make yielded no errors (which, relax, is typical ;) ) you are able to now issue the final command of the 3, which is a 2 word command:

#make install

See? It was pretty simple wasn't it? That, my friends, is what so many complain about as being hard. lol, I can't see it, either, but I can relate. In 1997 I wanted no part of compiling software because like you I had no real concept of what was going on. I had no understanding at all and there was no homey-funkster as myself writing up these wicked tutorials ;) So, I waited until I was less spooked, just a couple years later.

.deb Files

You may find that the software you need is available in a .deb package. This is even easier than compiling software yourself as it has already been done, like exe files. To install a .deb package you'll need to do one of 2 things, both very simple. Actually, to be truthful, there are more ways to get a .deb installed, but let's not get crazy.

I already mentioned gdebi. This handy utility allows you to double-click on a .deb file and it will install auto-magically. There are other such utilities but gdebi is the most common. An aptitude install gdebi away, too. The official way to install a .deb file (package) is with Debian's own official package manager - dpkg. This is another command line utility, but, like before, nothing at all to fear. Installing with dpkg is cake, like this:

# dpkg -i software.deb

That's it. You can use your central package management program to manage any .deb files that you have downloaded and installed. However, compiled programs may not be managed this way. It's this reason that many folks introducing Debian to new users will try to convince new users to avoid compiling. Pfft, not me -- have at it. Removing compiled software is easy, regardless if it's managed by Aptitude, or Synaptic. Removing .deb packages installed with dpkg is as simple as:

# dpkg -r software Or...

# aptitude remove software

Scripts and Stuff

The rest of the installation methods all deal with running a script, which is basically what all your programs are anyway and basically what runs your Debian system - scripts. You'll find many Python programs out there, java programs, and other programs that use a script to install the software. These are typically in containers, too. A java container, a bin file, etc. Installing these can be daunting until you know how. Let's discover...

It can be interesting installing scripts packaged in .bin files and the like. It's not hard, but you need to make some decisions. Install system wide or keep the program just for you - installed in your ~/ directory. If you want to install it just for you then you do not need to be root to install it. System wide installs need root. It gets weirder.

Some installs will use the /opt directory on your computer. Some will install to /usr/local/bin. And, again, some will install right into your ~/ directory. We can see how the argument for standardization is an important one when we are dealing with so many different package delivery and installation routines. We can also really appreciate the work of the Debian developers, here, too. They have packaged up for you ~23000 packages already, more than most will ever need. There are representatives of any type of function you can imagine within this repository of awesome and 9 times out of 10 you will never need to install software any other way then by using Synaptic, Add/Remove Applications, or my favorite - aptitude. But there are those times, hence this article.

I'll nutshell the rest because they're pretty similar. Following is the install methodology of these types of containers, scripts. Issue the following commands in your terminal in order to install the following programs:

For .bin files: $ ./filename.bin
For python files: $ python setup.py <argument>. For example: $ python setup.py install
For jar (java) files: $ java filename.jar
For .sh scripts : $ ./filename.sh

Keep in mind that many scripts do not come with a file-type suffix. Completely unnecessary in Linux so many developers don't include the filename.sh suffix.

To conclude, installing software on any operating system can be daunting. Yes, even Windows, actually, especially Windows. Just because the initial double-click action is painless doesn't mean that the resulting install action or the program/OS itself won't start barfing later. Installing software on Linux can be a royal pain in the backside, but if you stick to the way that the developers give you, you won't have any problems at all. Moreover, I bet you a beer (Guinness!) that within no time at all you come to appreciate the diligence and competence that is package management on Debian.

Extra Goodness for Enhanced Comprehension

Following are related articles that discuss many things but all have information regarding installing and managing software on your Debian system:

--machiner 22 Feb 09

For more software management goodness

0 - The filetype is ogv, it's an ogg file. Plenty of media players on your fancy Linux box will play it just fine. In Opera I use mozplugger to act as liason between mime types and my local programs that play them. It's very sweet. When I click on the video link Opera asks whether I would like to open or download the file. In the window it's revealed in a drop-down box that Mozplugger is the "program" playing the file. I choose to open it. Firefox will play it, no worries, as will most browsers on your Linux box. I made the video with gtk-recordmydesktop. Of course, just like in the video, it's an aptitude install away.

a - The aptitude commands you saw me type in that short video, search and install, are the result of aliases set up in my ~/.bashrc file. Instead of typing sudo aptitude - -without-recommends install foo I have an alias that shortens that down to install foo. Handy.

1 - Debian has 3 branches to its repository: main contrib and non-free. Main is enabled by default and contains software that is "free" in every sense of the word. Contrib and non-free are easily added and each contain software that is "libre" but not free in the sense that you can do whatever you want with it.

2 - It's simple to change branches. In your /etc/apt/sources.list you can replace stable, or "lenny" with testing or . This can lead to "mixing" though and if you're not going to move to one of those other branches, just avoid this temptation altogether. Or, become uber-geek like me so your family can poke fun at you. lol, it's all good.

Last Updated on Tuesday, 12 October 2010 21:14