Debian Package Management, Part 1: A User's Guide
Debian has one of the most powerful and versatile package management systems of any Linux distribution. It is also incredibly cryptic. However, once you start using it, I promise it does get easier.
Debian's basic package management tool is dpkg. dpkg is actually built on top of dpkg-deb, but I'll get into that later. There are a suite of tools built on top of dpkg, including dselect, apt-get, console-apt and others. This article functions as a HOWTO, providing commands and instructions on ways to manipulate dpkg and receive pertinent information about your Debian, or Debian-based system. I'm not going to cover everything, but enough so that, you'll be able to use the package management capabilities of your Debian-based system with proficiency.
Every Debian package is an archive ending with the extension “.deb”. For this article, I'll refer to a package as a “deb”. debs are usually named in the following manner:
For the examples in this article, I use “foobar.deb” when a deb needs to be substituted, and “foobar” when a package name is to be substituted.
For those familiar with the Red Hat Package Management (RPM) system, dpkg's approach to package management is much different in its approaches. RPM is a file-based package manager, meaning it checks for specific files required by a package like libgtk-1.2.so.0. In contrast, dpkg is package-based, so it checks to see if you have a specific package, such as libgtk1.2.
Most people will not use dpkg for day-to-day package management, but it is an incredibly powerful and useful tool. Dpkg's most basic action is to install a package, which is done with the command dpkg -i foobar.deb. This will install the package, while backing up any existing versions of the package. The command dpkg -i -R /foo/bar will install all of the debs in a directory.
We all know from experience that sometimes a package won't install properly or refuses to configure. Or maybe the user aborted the configure process. dpkg has some helpful tools for making the configuration process easier. In these instances, dpkg -configure <package> will finish the configuration of the specific package, and dpkg --configure --pending will configure all packages with configuration pending.
It is just as easy to remove packages with a few simple commands. Using either dpkg -r <package> or dpkg -remove <package> will remove a package and leave its configuration files. If you want to remove all files related to the package, including its configuration files, use the command dpkg --purge <package>.
Debian package management provides several ways to find information on what packages are currently installed and what files each package provides. One way to sort packages is by using a pattern, facilitated with the command dpkg-l <pattern>. If necessary, a wildcard can be used as the <pattern>. Using dpkg -l alone will provide a list of all the packages currently installed on your system.
Using Debian package management also allows you to see what files were installed by a specific package with the command dpkg -L <package>. Alternatively, to find out which package owns a file use dpkg -S <file>. These searches can also be done with a pattern, including wildcards.
When you need to get information about a particular deb, this list of commands is helpful:
dpkg -I foobar.deb lists detailed information about a debdpkg -c foobar.deb lists the contents of a deb, similar totar's -c option.dpkg -x foobar.deb <dir> extracts a deb intothe specified directorydpkg -X foobar.deb <dir> lists the files asit extracts them, like tar's-v option
In addition to all of the useful information that dpkg accesses for productive package management, it also has a rich set of options for screwing up your package management system royally. To quote dpkg's manpage, “Warning: These options are mostly intended to be used by experts only. Using them without fully understanding their effects may break your whole system.” I won't cover this set of options here, as you should never really need to use them. However, if you ever need to force dpkg to ignore dependencies, overwrite files installed by other packages, ignore conflicts or anything else the Debian package management system is designed to prevent, look at man dpkg.
Practical Task Scheduling Deployment
July 20, 2016 12:00 pm CDT
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.Register Now!
- SUSE LLC's SUSE Manager
- My +1 Sword of Productivity
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- Managing Linux Using Puppet
- Non-Linux FOSS: Caffeine!
- Tech Tip: Really Simple HTTP Server with Python
- Doing for User Space What We Did for Kernel Space
- Parsing an RSS News Feed with a Bash Script
- Rogue Wave Software's Zend Server
- SuperTuxKart 0.9.2 Released
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide