Installing Software Linux Style (Debian) Print E-mail
Written by machiner   
Wednesday, 08 June 2005 09:37

[EDIT: See this sister article about managing Debian system software]

This part of using Debian is a crowd favorite. One of the most compelling reasons to use Debian GNU/Linux is to take advantage of its package management program: Apt. Apt, and it's subordinates (apt-build, apt-file, etc.) are terrific. If there was an easier package and system upgrade management system I've never used it. The Gentoo crowd loves their "emerge " for the same reason, it's just as easy as what I just typed.

Now, behind the scenes there is a lot more going on, managing dependencies is a PITA (that means just what you think it does) but thankfully for you and your time Apt accomplishes this messy aspect easily and efficiently.

For the purposes of keeping my tutorials simple and devoid of techno-babble (besides, I'm just a hack with a domain name) we won't go into too much detail. As well, you're coming from Windows - you could care less about the intricacies of your package management, or any other system management, ey? Well, I hope someday you change your mind about that one, at least a little. By default, using Debian you will learn. That's just how it goes. I hope my tutorials are helping.

Installing software in Debian is accomplished in a number of ways, however, we'll only be learning about 3. They are as follows:

  • Compiling .tar files
  • using dpkg to install
  • Apt

On occasion we will use the command-line (CLI) to install apps with apt and also we'll use the Synaptic front end to Apt. It's the same process but some people prefer a GUI, and to be honest, sometimes I do as well, no matter how geek I think I am.

Using Apt

Apt accesses software repositories which are ftp sites loaded with any number of software packages. Some sites specialize in packages, like marillat is where we download our w32codecs from, that sort of thing. These repositories are stored as site addresses in a file called /etc/apt/sources.list. Take a look at this sources.list file.

These repositories included for a certain completeness.

As you can see, it's just addresses. If you want, go ahead and copy and paste this file data into your own, just make sure you are doing this as root. An easy way is to do the following:

Open Gedit. Copy my sources.list file data into an empty file. Save the file as "sources.list" in your /home/username directory. Now, open your terminal and become root. You can use the following cp (copy) command to replace your sources.list file:

# cp /home/uname/sources.list /etc/apt/sources.list

A system like this is terrific also because you can say goodbye to the days of seeking out software on the web. Say goodbye to installing "shareware" riddled with spyware apps. Say goodbye to those ridiculous EULA that sell us out completely and nobody bothers to read anyway. If you actually do I have some advice for you: Unplug your machine and go outside. Move out of your parent's house and get a life. Really, you're either terribly anal (and you'll have to fight me to get your picture next to that word in the dictionary) a lawyer, or just too far gone, man. Anyway - now you don't have to worry about that sort of thing. Just install the damned software and enjoy it - like God meant it.

I'm losing focus...

Apt does all of the hard work for you. So, let's take the heat off and think about installing codecs so we can watch dope videos on the web. Open your terminal, become root:

# apt-get update

# apt-get install w32codecs

That's it. Apt will download the files and supporting dependencies (if any) and install them. Enjoy!

Now, what if we didn't know what the actual file name was? No sweat. We can search for files (packages) with a similar name, or specifically, with "codec" in the name. We know it's called "codec" something because our 9 year old Grandson has told us this. To find the package we really need, it's about the same command:

# apt-cache search codec

You will see a list returned with packages containing that word. There is another way. We can find all packages containing a particular file as well. You won't use this much, well, maybe you will, but it's worth mentioning. Instead of the apt-cache search command you would use apt-file for this chore.

FIRST - install apt-file, so -

# apt-get install apt-file

Then, update it,

# apt-file update

Now you can use apt-file to find out which package libbeingdifficult6++.so.6 belongs to, install it, and have dependencies resolved so you can install (compile) billyrays-uber-cool-proggy. Like this:

# apt-file --package-only search libbeiingdifficult6++.so.6

This will show you the package containing the libbeingdifficult6++.so.6 file. Cool, ey?

Could it be any easier? After you have found the file you need to install, you can install it:

# apt-get install package-that-contains-libbeingdifficult6++.so.6

Watch the magic.

Using Synaptic

Synaptic is even easier. Go ahead and open it. If you copied my sources.list file to your own, click the "reload" button in the menu bar. Aw, do it anyway. Searching for a package or software type, let's say "movie" if we want to install a mpeg player like Totem, which is already installed, but there are others, is trivially easy. Click the "Search" button (or, CTRL + F) and type in "movie", from the drop-down bar beneath where you typed movie, click and choose "Description & Name". Now click - Search. It took less than 2 seconds on my 'computer to yield the results. If you use "mpeg" instead of "movie" you'll get more and perhaps better results. One program that is an absolute must is "ffmpeg" and it won't show up in the results for "movie".

Now that you've found your software, right-click on the one you want and choose "mark to install". You can either go mark 2 or 80 more or you can install right now. If you're ready click the "Apply" command in the menu bar. In the box that pops up click Apply again. There, wasn't that easy?

In Synaptic you have no doubt noticed that when you click on "mark for installation" you may get a box pop-up notifying you of dependencies the package you want to install needs to operate. Sure, you were smart and you clicked "mark" for those as well. When we were using the Apt command line tool you saw a flood of text that does the same thing if necessary. In this situation we either type a "y" or a "n" to either allow the dependencies or not.

While you're in Synaptic, search for "checkinstall" (as of March 22, 2007 checkinstall is not part of the Etch repositories) and install that bad-boy. You'll find out why later.

People love Apt (Synaptic). And why not? It's a terrific way to maintain your computer. I check for updates (Mark all Upgrades -- or # apt-get upgrade) every day and if there are any I'll let them be installed. You should, too. This is how we Linux users keep our security problems down to a minimum or nonexistent. Let those programmers that bust their hump for us continue to protect our computers.

There's more to know about Apt and Synaptic but I'll let you figure that out. Go ahead, explore Synaptic, you may be glad that you did.

Installing .deb files

Earlier I said that you don't have to worry about downloading software. Well, that's not entirely true. There will be the occasion that you will want to install a piece of software that isn't included in any of the repositories. For instance, someone told you about www.gnomefiles.com and you checked it out. You found a package that you want (I fricken' NEED it!) and you download it to your nicely organized /home/uname/downloads/utilities directory. The only trouble is that this damned file is a .deb file. HUH?!

No worries. Installing a .deb file is a piece of cake. However, this is one of those times that you'll curse Linux - you may run into something called "dependency-hell". You have no way of knowing if you have all the required dependencies installed to support this "gotta-have" app. There's not much you can do except scour the developers web page for requirements and make sure you've got 'em installed. Typically, though, it's never that easy. It's not very intuitive either. Some packages require another package but the name is not-at-all helpful. Say the developer's web site let's you know that you need "package223-0.45" as a dependency to install their app. Trouble is that in Debian that file is called something else. You'll search every which way you can in Synaptic - but you're wasting your time. This is where your favorite search site comes in handy. Copy the requirements into a search directory (aw, go ahead - use Google) and let the wisdom of users before you be your guide. Also, the author of said program may have a forum on his (her) site....use it.

There are 2 simple ways that you can install a .deb file. One is with the following script:

Go ahead and download/save that file as, oh I don't know, "install-deb-files" in your /home/uname/.gnome2/nautilus-scripts directory. That "." in the .gnome2 directory name means that the directory is hidden. When the "save as" command opens the location directory, right-click in the directory listing area and check "show hidden files". After you have saved this script open Nautilus, goto that directory, right-click on your new script, choose properties, choose permissions, and check the "executable" box in the owner line.

Speaking of Nautilus Scripts, here are 2 that I use all of the time:

install-deb-binaries
terminal-here

Go ahead and download (right-click, save link as) these and put them in your nautilus scripts directory.

Now installing that .deb file is a piece-of-pie. You simply right-click on the file, choose "scripts" and click on your new script. A terminal will open asking for your root password. You'll see it install and then the script will tell you to hit "enter" to close the box. Your cool-ass-gotta-have package is installed. Go ahead and run that bad-boy.

The other way to install a .deb file is just as easy. Open your terminal and $ cd to the directory holding your app. Become root and type the following command:

# dpkg -i cool-ass-app-name-2.3.deb

If the install fails because of missing dependancies the installer will show you which packages you need to install. It's kind of cryptic, just look carefully and you'll see that "package-A" is either too low a version number or it doesn't exist at all. What I do in this situation is to fire-up Synaptic and see if I can't find it to install it. What's really terrific about Apt (Synaptic) is that when you do open Synaptic it will notify you right away that you have a broken package. To fix this goto Edit, Fix Broken Package Another really cool thing about Apt is that if it can it will install those packages that you were missing when you tried to install the .deb file. That's cool. So instead of just removing it, it really will fix it if it can.

EDIT, March 2007: With the advent of Debian's Etch operating system there is a new program included called gdebi. This is a GUI program used for installing .deb files on your system. It's too easy. After you've installed gdebi and chosen it to open .deb files, (right-click on a .deb one time, choose "open with" and then browse to /usr/bin/gdebi - you only have to do this once) it will install them any time that you double click on one. Ya -- just like double-clicking on an .exe file in Windows. What's really cool is that gdebi will download all the dependancies that whatever program you're installing is missing so you don't have to hunt them down, or rely on Synaptic to do it for you later. If the deps are not available in your repositories you will see this in bright red letters at the top of your gdebi install screen. gdebi is just another little niceity that the folks from Debian have added to Etch to make your computing experience that much more enjoyable. END EDIT

So, we've learned about 2 ways to install apps on your Debian system. Now we come to the third and my favorite. I don't know, I get a certain satisfaction out of compiling packages myself. Installing packages this way gives you alot of control over the install and it optimizes the package for your system. You just can't get that sort of functionality in Windows.

Compiling .tar Files

You will no doubt find another gotta-have app in your web or circle travels that you want (need to) install. This time the only way for you to get this package is to download a .tar file. This is just an archive (like .zip files) containing all the necessary files for this app to install and run, except dependancies...and configure to your machine(r).

Pick your favorite way to extract the files, but if you want dead-nuts easy just open Nautilus and goto the directory that contains your .tar file. Right-click on the file and choose "extract here". If you don't immediately see the directory refresh and reveal a folder with the same name of your .tar file, hit CTRL + R and it'll happen. You could extract this file from the command line just as easily; $ tar -xvf package-name-0.3.tar. Look here for help extracting compressed files [.tar .bz .gz .zip, et al] it's simple - you'll have it down in no time.

Open a terminal and cd to the directory containing your extracted files. Once you're in that directory you can begin the install. It's a good idea that you have already made sure that you have the required dependancies installed before you begin the install. Otherwise you'll be at the same point of failure you found when installing .deb files. If you don't have the dependancies installed your install will fail early - but it will tell you what files it needs.

Installing .tar packages is easy and you need not be scared because your chicken-shit or lazy friends were and told you it was impossible. I made that mistake in '97 and it took me 5 more years before I went back to using Linux because of it. I was just lazy. Here's the typical commands:

  • ./configure
  • make
  • (as root) make install

That's all there is to it. I normally do the following, however, to see if I can't further optimize or control my installation:

$ ./configure --help

This will show you some options you can use when installing your app. We'll forgo all that for today and just focus on the typical.

You have made sure (as best you can) that all required dependancies are installed and you're ready to install, so - let's do it. Your terminal is already open and you're already in your app' s directory...

Type the following at the prompt:

$ ./configure

Your app is now checking to see if your machine can run the app and it is re-writing and creating the files necessary to install the app on your box. Next we type:

$ make

Now the installer is making all the necessary files used for actually installing your app.

Now, become root, # checkinstall

We could have typed the typical make install here but we want Apt to manage our system don't we. When you compile your own packages like this, Apt (and/or dpkg) has no idea that the package is installed. We installed "checkinstall" earlier to overcome this and allow Apt to manage the file. When you install with "checkinstall" you can open Synaptic later and see that your package is listed. Cool.

Checkinstall will prompt you through its installation routine. You will most likely have to enter a description for the package (just the name and version number, I use app.0.4) then the installer will continue. What checkinstall does is to create a .deb file first, then install that. That's cool. Just make sure you don't have Synaptic open when you are using checkinstall or the install will fail.

I think that about covers it, ey. I think that's enough for today - my kids are complaining that I have been ignoring them. If this tutorial has helped you - why not leave a comment like "thanks Carter and Madison for letting your Dad write this tutorial instead of playing with you." I know they'll appreciate it.

There are other types of software you will see like bin files or sh files (nVIDIA's binary for instance). You will probably see a jar file or 2 as well. This is how we install those:

$ ./cool-ass-app.bin

$ sh nother-cool-ass-app.sh OR $ ./nother-cool-ass-app.sh

$ java -jar cool-ass-java-app.jar

[IMMEDIATE ADDENDUM:]

Often after installing software you will not see the package listed in your Applications menu. No worries; there's a good chance that after you logout and log back in that the menu item will be there. Please note that there are about a zillion people that write software used by Linux and some of them don't have a menu entry. You may or may not notice that the Debian Menu has an entry for your new software. Menu's are an item that the Gnome development team are working on.

I'm pretty sick of typing today, so tomorrow I'll write a quick snippet on adding program shortcuts to your desktop and/or menu bar. Yes, you can drag from your Applications menu.

machiner 8 jun 05

Here it is Where are my newly installed apps

UPDATE: well, looks like I never finished this article. What a hack! Well, I did write up a quick companion piece. Check it out.

Last Updated on Saturday, 28 February 2009 10:06