dcsimg

Do You Have an Aptitude for Software?

If you think smart is intelligent or if you think yum is tasty, aptitude will expand your thoughts with attitude.

Last week, in Part One of this Debian Package Primer, I gave you an introduction to the super cow powers of apt-get, Debian’s package management system. This week, in Part Two, you’ll check out aptitude, which is an easy to use front-end for apt-get. It has menus, shortcuts and a package status dashboard that keeps you aware of your installed packages and how many you have yet to install.

If you’re like me, an avid apt-get user, then you’ve felt the frustration of typing in what you think is the correct package name and seeing the incredibly informative and helpful, “Couldn’t find package X” message. Aptitude gives you menu-driven super cow powers and removes much of that frustration.

The Basics

Unlike apt-get, you don’t have to be root to start aptitude, or look around, but you do have to have root privileges to install, update or remove packages. To start using aptitude, type aptitude at a prompt.

$ aptitude 

Or, if you prefer to have root privileges,

$ sudo aptitude 

A menu similar to the one in Figure 1 will appear.

Figure1.jpg

Highlighted by default are your Installed Packages or Security Updates (depending on when you performed your last update0 and their number. Press the ENTER key to explore packages listed under any of the major headings. You’ll see that these are cascading menus, meaning that they are hierarchical, with submenus. Once you’ve opened the admin menu, for example, you’ll see main – The main Debian archive (33). Opening that menu reveals a list of installed packages as shown below.

--\ Installed Packages (281)
  --\ admin - Administrative utilities (install software, manage user, etc) (33)
    --\ main - The main Debian archive (33)
i	acpi-support-base			0.109-11     0.109-11
i	adduser				3.110     3.110
i	aptitude				0.4.11.11-     0.4.11.11-

You can see that this menu-driven system is much easier than searching for a package name (or guessing at it) and then using dpkg to display information about it.

# dpkg -l |grep apt
ii  apt			0.7.20.2		            Advanced front-end for dpkg
ii  apt-utils		0.7.20.2		            APT utility programs
ii  aptitude		0.4.11.11-1~lenny1           terminal-based package manager
ii  laptop-detect                0.13.6			attempt to detect a laptop
ii  libpcap0.8		0.9.8-5			system interface for user-level packet capture
# dpkg -l aptitude

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name                 Version              Description
+++-====================-====================-===============================
ii  aptitude             0.4.11.11-1~lenny1   terminal-based package manager

Let’s take a look now at what aptitude can do for you as a user or system administrator.

Using Aptitude

The aptitude menu system has keyboard shortcuts available, as well as, dropdown options for most activities. The dropdown options simplify your necessary operations until you’re more familiar with the corresponding shortcuts. For example, if there’s a keyboard shortcut available for the command or operation you want to perform, it’s shown on the menu.

The first thing I do when I enter aptitude is press the “u” key to update my package list. Doing so has the equivalent effect of the apt-get update command but with very different visual results (See Figure 2). Press the “u” key on your keyboard and watch your screen change.

Figure2.jpg

The update process might take several minutes depending largely on how often you perform an update on your system.

The next step is to upgrade your system with all of the new found updates. To upgrade your upgradeable packages, press the “U” key. This marks all upgradeable packages. Press the “g” key to queue the upgradeable packages. Press “g” a second time to start the upgrade process.

If you aren’t root already, you’ll be prompted to become root before proceeding. You’ll have to press “g” one final time to start the process in this case. Once the process completes and returns you to the main menu, you’ll notice a difference in the number of installed packages. Mine went from 281 to 342.

Installing a single package is a simple process that requires no guessing, wildcard searches or Internet searching. Under “Uninstalled Packages,” find the package you want to install and press the “+” (plus) key to mark it. The package you selected turns green to show that you’ve selected it for installation. Information about the marked package appears in the window below the selected package.

Press the “g” key to queue the package and its dependencies. Press “g” again to launch the installation process.

To remove a package and its unused dependencies, you perform a similar set of operations to those of installation. Under “Installed Packages,” locate the package you want to remove and press the “-” (minus) key. The package will turn magenta in color and warn you of any packages that depend on the one you want to remove. When you’re satisfied with the package removal, press “g” to queue the removal and to list any unused dependencies. Press “g” again to remove the queued package(s).

From the Menu

The top menu options (Actions, Undo, Package, Resolver, Search, Options, Views, Help) in aptitude contain several options for you but there’s no on screen message or legend that tells you how to access it. To access the top menu, press the “F10″ key.

The Actions menu opens for you. Use your keyboard arrow keys to navigate to the various options and the other menu headings. Press the “ESC” key to toggle out of the top menu and back to the package dashboard.

This brief aptitude introduction will have you more productive and less frustrated with upgrading, installing and removing software packages. And, fumbling with packages and obscure package names can prove quite frustrating.

Next week, you’ll explore the wonderful world of Linux user and group administration.

Fatal error: Call to undefined function aa_author_bios() in /opt/apache/dms/b2b/linux-mag.com/site/www/htdocs/wp-content/themes/linuxmag/single.php on line 62