Debian Package Management, Part 1: A User's Guide
APT stands for “Advanced Package Tool”. It does a wonderful job of simplifying the life of a Debian user. If the last session discouraged you, fear not! APT is what I use for most of my package management. Why then, you ask, did I force dpkg on you? Because it's important to know what is underneath APT.
The APT system consists of three major parts: the configuration file, sources.list, and two programs called apt-get and apt-cache. There also are some minor parts, like apt-cdrom.
Once you learn how to use it, /etc/apt/sources.list will become one of the most important files in your system. For the most part, sources.list consists of ftp and http addresses where APT can go to pull information, and is a great way to organize your resources in one location. A typical entry looks something like:
deb http://http.us.debian.org/debian unstablemain contrib non-free
The first part of the entry is either “deb”, for a line that specifies where to acquire binaries from, or “deb-src” which specifies where to acquire debian source packages. The next part is called a URI, which is similar to a URL; this is the root of the debian directory. After the URI comes the distribution, which is generally listed as “stable”, “frozen” or “unstable”, although a specific distribution, like Hamm, Slink or Potato, can be used. Distribution can also be given as an exact path, in which case it needs to end with a “/”, and no components can be specified. Components are usually “main”, “contrib”, “non-free”, “non-us/main”, “non-us/contrib” or “non-us/non-Free”. That's about all you need to know to take advantage of sources.list. CD-ROM entries are generated by apt-cdrom (more on this later), so you don't need to write those by hand.
Editing the source.list file is done to change the sites APT uses (changing mirrors), to change which distribution APT will be getting packages from, or simply to add new URIs for “unofficial” debs, or sites which maintain newer debs, like KDE and HelixCode, respectively. After editing this file, you should always run apt-get update. For a listing of Debian mirrors to use, check http://www.debian.org/.
One way to add your Debian CD-ROMs to APT's database is with the remarkably easy-to-use apt-cdrom. The command apt-cdrom add should automatically mount your CD-ROM (provided /dev/cdrom is correctly linked), scan it and create the correct entry in /etc/apt/sources.list.
As with anything in Linux, that's not the only way to do it! If your Debian CD-ROM is mounted (the mount point must be listed in /etc/fstab), you can use a few flags to accomplish the task. Use -d <mount point> to specify the mount point,-f to make apt-cdrom not check the individual packages, and -a for a thorough package scan that will look for package files everywhere on the CD-ROM.
Debian's greatest claim to fame is apt-get, an incredibly smart (okay, smart most of the time), easy-to-use package tool that automatically deals with package dependencies and conflicts. The first thing you should do (and do it every time you edit /etc/apt/sources.list) is run apt-get update, which pulls the package information used by apt-cache and apt-get from these locations.
Now, you can go about installing packages. APT's most used action is probably install. To install a new package (and automatically meet its dependencies), use apt-get install <package>. If there are other packages that must be installed, APT will let you know before downloading them.
If you install a deb without meeting the requirements, or a problem is encountered during install or removal, you will often be unable to work with dpkg until the problem is resolved. One method to use for solving these problems is the command apt-get -f install, which will try to work everything out and ask questions as it goes along.
APT can also download sources with apt-get source <package> if you have any deb-src lines in your /etc/apt/sources.list. To remove packages, use apt-get remove <package>. If you want to clean out the archives, there are two options. To remove all archives, the command is apt-get clean; if you only want to remove old archives, use apt-get autoclean instead. When the time comes to upgrade all packages to their latest version, one easy command, apt-get upgrade, will take care of it. Meanwhile, apt-get dist-upgrade is suited for upgrading to a new version of Debian, automatically reconfiguring dependencies for packages whose names have changed.
A few other command-line options are helpful when using apt-get: “-d” only downloads archives but doesn't try to install or unpack them; “-s” for simulation, it won't actually do anything; “y” answers yes to all questions; and “-b” tries to build a source package after downloading it.
Additionally, apt-get can use regular expression patterns such as apt-get install '.*mame.*' or apt-get remove 'mozill.'. Apt-get will also try to match an element appearing at a specific point in the string. For example, to match “pilot” only in the beginning position, like “pilot-manager” and not “gnome-pilot”, use “^” (which is the “beginning of line” character) in an expression like apt-get install '^pilot.*'.
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- RSS Feeds
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- Home, My Backup Data Center
- A Topic for Discussion - Open Source Feature-Richness?
- What's the tweeting protocol?
- Dart: a New Web Programming Experience
- Developer Poll
- Trying to Tame the Tablet
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.




3 hours 4 min ago
5 hours 37 min ago
6 hours 54 min ago
7 hours 29 min ago
7 hours 51 min ago
12 hours 40 min ago
13 hours 27 min ago
15 hours 57 sec ago
16 hours 37 min ago
18 hours 35 min ago