The CLI Edition
Okay, so I must confess up front, I’m not going to give you any information about adept here. This is related to adept, though not actually about adept. This is about how to get behind the scenes of package management. I invite all you happy people to comment on this entry with your own tips and tricks. Let us please stick to deb-related stuff here (sorry RPM and Gentoo people, but focus helps learning).
By the way, since my target audience is Mary Sue home-maker and Joe Schmoe, I promise to do my best to expand my acronyms. To that end, “CLI” is “Command-Line Interface.” A command-line interface is a text-based interface where a user types in commands and the computer–like a good little kitty–does as it is told. To get to the command-line interface you can use a terminal emulator. I like Konsole, so let’s use that one. Go to the K menu and go to the “System” submenu, and locate “Terminal Program (Konsole).” Click on it and a new window will open that will look something like…
Okay, so let’s talk about this in scenarios….
So, you want to install a program.
So, I’ve been hearing quite a few good things about this awesome children’s learning game GCompris. I want to install it to check it out for myself. To do this I start up my handy-dandy konsole and take to the commands. So, I already know what package I want to install, so let’s go ahead and install it now. You do this with apt-get. I’ll show you the command first, and break it down for you afterwards.
sudo apt-get install gcompris-sound-en
Okay, so sudo is a command that allows you to run everything that follows as root. You should always be careful when doing things as root. Make sure that when you do this that you know know what package it is that you’re installing. All main ubuntu software repositories use GnuPG signatures to verify the authenticity of the packages, so normal ubuntu repositories are pretty reliable.
Next up, apt-get is the remote package installer. It grabs packages from the repositories and it installs it on your computer. The install portion is instructing apt-get to install the package. And, of course, gcompris-sound-en is the package we’re installing.
So, now I’m installing the gcompris-sound-en package, which is the sound package for gcompris for the English language. I like sound, and I suspect you do as well. Here’s the output of the above command for me. This will very likely vary for you…
manchicken@larry:~$ sudo apt-get install gcompris-sound-en
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 15 not upgraded.
Need to get 1885kB of archives.
After unpacking 2699kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com edgy/main gcompris-sound-en 7.4-3ubuntu2 [1885kB]
Fetched 1885kB in 7s (245kB/s)
Selecting previously deselected package gcompris-sound-en.
(Reading database … 235936 files and directories currently installed.)
Unpacking gcompris-sound-en (from …/gcompris-sound-en_7.4-3ubuntu2_all.deb) …
Setting up gcompris-sound-en (7.4-3ubuntu2) …
So, to be exceedingly concise, what this is doing is opening the database, reading dependencies, locating the package to be installed, determining disk space requirements, informing me of disk space requirements, downloading the package, installing the package, configuring the package, and then closing the database. I’m sorry that I don’t have the time to explain in any more depth than that, but it would really take a while. Package management software is multi-faceted and complicated.
So, I’m going to explain one more scenario and then I’ll let you folks share. Sharing is good; don’t let anybody else tell you differently.
So, you have a program, you’d like to know what it is and where it came from.
I can’t tell you how many times I’ve wanted to know this information. This is a two part process how I do it. Others may have better ideas. Let’s all learn and share together.
What on earth is /usr/bin/dund? I’ve never heard of it before. Let’s learn! So, first, let’s find out what package it’s in. To do that we can use dpkg-query. dpkg is the debian package manager, and dpkg-query queries dpkg. Here’s the command…
dpkg-query -S /usr/bin/dund
Now, dpkg-query is the program we’re running. The -S flag tells it to look for a file name in the database and tell us where it came from. The /usr/bin/dund argument, of course, is the file we’re trying to look up. When I run that I get:
That tells us that /usr/bin/dund comes from bluez-utils. Now we can use apt-cache to find information about the package. Here’s the command:
apt-cache show bluez-utils
This command tells apt-cache to show us details about the package bluez-utils. Below is the output.
Maintainer: Ubuntu Core Developers
Original-Maintainer: Debian Bluetooth Maintainers
Replaces: bluez-sdp (< = 1.5-2), bluez-pan
Depends: libbluetooth2 (>= 3.0), libc6 (>= 2.4-1), libdbus-1-3, libusb-0.1-4 (>= 2:0.1.12), module-init-tools, makedev (< < 22.214.171.124-0) | udev, lsb-base (>= 3.0-3), dbus
Conflicts: bluez-sdp (< = 1.5-2), bluez-pan
Description: Bluetooth tools and daemons
This package contains tools and system daemons for using Bluetooth devices.
BlueZ is the official Linux Bluetooth protocol stack. It is an Open Source
project distributed under GNU General Public License (GPL).
More information is available at http://bluez.sourceforge.net/
Task: ubuntu-desktop, kubuntu-desktop, edubuntu-desktop
Oh, wow. Now we know what this is. It is a bluetooth protocol package. I think this output is pretty self explanatory. I could explain all of these lines as well, but as previously mentioned, it would take more time than I’m willing to dedicate to this one post. If you have specific questions, ask in the comments and we can learn together.
Okay, so I’m done now. I really hope this has been helpful, and I truly encourage you to comment and share and learn. With this software you have freedom and you can help your neighbor. Let’s exercise this freedom and help our neighbors. Nighty night all you happy people.