Apr 17 2007

LCoTD: Installing Software under Ubuntu (And Most Other Distros)

Published by georgegumpert at 1:31 pm under Linux Command of the Day, Linux Resources, Series ()

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

OK, so the thing that kept me from using Linux for the longest time was the fact that it had little to no software availability. Or so I thought. While it remains true that I use Photoshop and 3D Studio MAX above all else, and will never fully switch to Linux (sorry, The GIMP just doesn’t cut it for me), there is a wealth of software available written and maintained by the open source community. This Lesson will teach you how to install it.


Here are the main ways to install software in order of ease (easiest to hardest):

1. aptitude/Synaptic/Adept

Ubuntu has something called aptitude, which allows you to draw from a set of online repositories (stored in the /etc/apt/sources.list file) that house packages (i.e., programs/software). You can enable extra Ubuntu repositories by following these instructions–extra repositories means more software available to install. The aptitude command does several things at once–it downloads the appropriate files, downloads all their dependencies, and installs all of them. A single command installs the software. You don’t have to download a separate installer file or unzip or go through a wizard or reboot. For example, if I wanted to install Thunderbird, I’d type these commands in a terminal:


sudo aptitude update
sudo aptitude install mozilla-thunderbird

The first command looks both at what I have installed and what’s available in the repositories. The second command downloads the packages needed for Thunderbird and installs them.

Another great thing about aptitude is the ability to install several different packages at once. For example, if I wanted to install not only Thunderbird but Firefox, GIMP, Inkscape, Juk, and Wine, I could type in these commands:


sudo aptitude update
sudo aptitude install mozilla-thunderbird firefox gimp inkscape juk wine

and all of those packages would download and install themselves.

On the Ubuntu forums and in many of the Wiki and other guides, you’ll often see instructions to sudo aptitude install some package or other. People will give you commands because it’s easier than describing what to click in a graphical user interface, and you can just copy and paste the command.

However, there is a graphical version of the package manager that acts similarly to aptitude. For Ubuntu, it’s Synaptic Package Manager. For Kubuntu, it’s Adept Package Manager. In both, you’re essentially doing the same thing. There’s also a nice “browsing” environment in which you can search for packages by name and/or description. You can browse by categories of software or look at what’s installed versus what’s not installed. It’s a lot like an ecommerce model of “shopping” for software, except you don’t have to pay when you “check out.” The equivalent of sudo aptitude update is clicking the Reload button. The sudo aptitude install command, however, is broken into different steps. Instead of listing a bunch of applications you want to install, you mark each one for installation (or removal), and then click Apply Changes or Commit Changes and then everything’s downloaded and installed (or uninstalled). Here’s a guide on how to use Synaptic Package Manager (complete with screenshots), in case you need pictures to see what it’s all about.

The advantages of aptitude over apt-get

aptitude has an important feature that its command-line cousin apt-get and the graphical frontends Synaptic and Adept do not have–it remembers dependencies. If you update with aptitude, install with aptitude, and then uninstall with aptitude, all the dependencies you installed with a particular package will be removed when that package is removed (unless other packages also depend on those dependencies). If you install with Synaptic, Adept, or apt-get, uninstalling will uninstall only the package you specify–not the dependencies that came with it.

For example, if you install kword, you will also install kspread, kword-data, and libwv2-1c2. If you install kword with aptitude and then uninstall with aptitude, kspread, kword-data, and libwv2-1c2 will also be removed along with kword. If, however, you install kword with apt-get and then uninstall kword, kspread, kword-data, and libwv2-1c2 will remain installed, and you will not be prompted to remove them.

More details on the differences between aptitude and apt-get can be found here, including a disclaimer about apt-get in Ubuntu 6.10.

2. Manual installation of a .deb

While the Ubuntu repositories are quite extensive (especially if you add extra repositories), they don’t cover everything. Sometimes (for the Opera web browser, for example), you have to install a separate file. If you must do so, then try to get ahold of a .deb file. .deb is the native file format for Debian-based distributions like Ubuntu. In fact, if you actually visit the online repositories, you’ll notice that the files there are mostly stored as .deb files.

The only difference between manually installing a .deb file and using aptitude to install a .deb file is that aptitude will resolve dependencies for you (if one package needs another to be installed, aptitude will install that “pre-requisite” package). If you manually install a .deb file, you will also have to manually install its dependencies. Don’t worry, though–if you try to manually install a .deb file and it has dependencies, you’ll soon find out what those dependencies are.

Here’s what you should do.

Download the .deb file to your desktop. For this example, let’s use Opera. Now, the Opera file that’s currently available for Ubuntu has a quite ugly name: opera_9.10-20061214.6-shared-qt_en_i386.deb. There are several ways to deal with this ugly name, seeing as how you have to type in the exact name of the .deb file in order to install it. You can rename it to something simpler (say, opera.deb), you can copy and paste the name, you can begin typing the name and then hit the Tab key to have the terminal autocomplete the name of the file, or you can just suck it up and retype it exactly as is. Let’s assume, though, that you’re going to do it the ugly way. You’d open up a terminal and type these commands:


cd Desktop
sudo dpkg -i opera_9.10-20061214.6-shared-qt_en_i386.deb

That’s it… well, as long as there are no dependencies. And if you prefer pointing and clicking and if you’re using Ubuntu 6.06 (Dapper Drake) or newer, you can also just double-click the .deb file to install it.

3. Manual installation of a .rpm

Occasionally, for a program, you’re just not able to find a .deb. There may seem to be, however, a plethora of .rpm files for the program. If you must use an .rpm (not native to Debian-based distros), then use an .rpm. It’s a very similar procedure to the .deb one described above, just using a different command (one that converts the “alien” format of .rpm):

One-time deal, just to get alien:


sudo aptitude update
sudo aptitude install alien

Now you can actually use alien:


cd Desktop
sudo alien -i opera_9.10-20061214.6-shared-qt_en_i386.rpm

Again, no dependencies will be resolved.

4. Installing from source

Some people prefer to install from source, but I listed it last because it’s what usually scares people off from Linux and makes them think “Why is it so difficult to install software in Linux?” However, it’s still an option, and unfortunately it’s sometimes the only option, depending on how obscure the software is you’re trying to install.

The first thing you’ll have to do in Ubuntu is install a meta-package called build-essential (a meta-package isn’t a real package–it’s a pointer that tells Synaptic/Adept/aptitude to install a bunch of other real packages):


sudo aptitude update
sudo aptitude install build-essential

I can’t think of a program off the top of my head that I ever needed to install from source, so I’m just going to make something up–let’s call it obscure-1.0. Most likely, it’ll come as zipped file called obscure-1.0.tar.gz. Download this to your desktop. Then type this in a terminal:


tar -xvzf obscure-1.0.tar.gz
cd obscure-1.0
./configure
make
sudo make install

Installing from source, like the previous two methods, also does not resolve dependencies–you’ll have to install those separately. The ./configure command may indeed tell you what dependencies you need but in a rather peculiar way; for example, it will often return with, say, a rather cryptic gtk not found, in spite of the fact that the user has gtk installed! In fact, what is actually missing is the gtk development files, libgtkx.y-dev. In general, when it says can’t find library blah and libary blah is already installed, it usually means that it can’t find the blah development files, which can almost invariably be found and installed by searching synaptic for blah dev. [Most of this paragraph was contributed by GeneralZod from the Ubuntu Forums--thanks, GeneralZod!]

There’s also Checkinstall: Once checkinstall is installed, instead of typing

sudo make install

you type
sudo checkinstall -D

and the program creates a .deb file which is then installed. This makes removing any program compiled from source extremely easy. For more details see the Wiki: https://wiki.ubuntu.com/CheckInstall. [Most of this paragraph was contributed by gingermark from the Ubuntu Forums--thanks, gingermark!]

Note: in both Ubuntu and Kubuntu, you can “un-tar” (or unzip) a .tar.gz graphically. I’ve never had to use the tar terminal command. To un-tar a .tar.gz graphically, just open it (double-click usually does this), then click on Extract.

Those are the major ways to install software in Ubuntu. Please note that not all .tar.gz files contain source code. Some are precompiled binaries. If you come across these, please ask for help on the forums. You may also find on the Ubuntu forums some great self-installer scripts and other helper programs.

[Source: psychocats.net]

Sphere: Related Content

If you found this article useful and use StumbleUpon, please give it a thumbs up so more people can read it! Thank you!

Please take the time to check out this thread and leave a comment letting me know what you would like to see from this site. It's still relatively young and trying to find its way- you can make design pitstop the resource you always wanted!

Leave a Reply