ltstudiooo - Fotolia

Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

What non-Linux admins need to know about the apt-get tool

Apt-get is a widely used application manager for Unix and Linux systems, so even Windows and Linux admins can benefit from knowing its requirements.

The Advanced Package Tool, also known as apt-get, is an application manager for Unix and Linux-like systems. It was originally released in 1998 to handle retrieving and loading applications into Debian Linux systems. One of apt-get's claims to fame is its excellent ability to resolve software dependencies. It normally uses .deb-formatted files, although it has been modified to also handle Red Hat's Package Manager (RPM) files using apt-rpm.

Apt-get is widely used by the Linux community, making it an important tool for managing desktops, notebooks and networks. As Linux gains popularity in the enterprise, it makes sense for Windows and Mac users to be aware of how applications are loaded using apt-get.

Also, with increasing interest in the single-board devices, such as the Raspberry Pi, apt-get is a convenient way to load applications on those platforms. If the program you want to load needs a library or another application to work properly, apt-get will find it and load that code as well. The current stable version is 1.0.9.2, released in October 2014.

Mainstream Linux systems using apt-get include Debian and variants of Ubuntu. Most of the time, the tool runs from the command line. There are a few graphical front ends you can use on the desktop, including Synaptic Package Manager, the Ubuntu Software Center, Aptitude and Kpackage. Raspberry Pi and Beaglebone Black nano-Linux board users can easily use apt-get to load programs because these systems generally are derived from Ubuntu or Debian code.

The Red Hat Package Manager is an alternative package manager and uses a somewhat different methodology. Generally, you can use RPM on Red Hat systems to load applications.

One package manager isn't necessarily better than another. I think dependency resolution under apt-get is better than in RPM, although I also think it's a little more complicated to use, particularly for novices working from the command line.

Pre-requisites

You need Ubuntu, KDE or Debian on the machine in whose the command line apt-get will be used.

Loading applications, called packages, is a little different than on Windows or Mac machines. Typically you'd grab an installation file on Windows and execute it to load the new program. There may be digital rights manager issues to deal with. Many times, you'll need to have superuser or root privileges to run apt-get on the Linux box. That makes sense, because you don't want just anybody loading programs on your machine. The sudo command gives you temporary privileges for apt-get when loading applications on your individual notebook and desktop.

Using apt-get

The basic form of the command for apt-get is:

               sudo apt-get install [package name]

Before loading a new application, it's best to issue a command that brings all the application repository lists up to date. The following command retrieves a new list of available apps in your repositories.

               sudo apt-get update

After completion, you can then use the normal apt-get install to load the program.

For example, if you wanted to install the popular Wireshark network sniffer, you'd use the following command:

               sudo apt-get install wireshark

The command will run, and you'll see some text scroll by. At some point, you'll probably be asked a question if you want new files downloaded and installed. This is normal and you'd just type "y" for yes to proceed.

After a little while, you'll be returned to the command line, and the program will be available for use. You can execute the file from the command line, or it may show up in one of the desktop menus. Sometimes the program name won't appear in the desktop menus until you log out and then log back in.

Say you don't want a certain application on your Linux notebook anymore. Removing the program with apt-get is one option. Here's the appropriate command

               sudo apt-get remove [package name]

Removing our newly installed Wireshark program might look like the following.

               sudo apt-get remove wireshark

This time, you'll get a message asking if you want to free up disk space. Again, just type "y" to proceed.

Suppose something goes amiss with apt-get or your power goes off while installing a package. Just check to see if there are broken dependencies with this command:

               sudo apt-get check

If you need to fix a package or repair dependencies, you can use apt-get with the "-f" option. Make sure to run the autoremove option to get rid of any broken stuff that's hanging around.

               sudo apt-get autoremove

               sudo apt-get install -f

If you run into problems running apt-get, a good place to find a solution is the apt-get wiki from Debian.

What's next?

There is quite a selection of options for apt-get. You can get a terse list of options from the command line with the following:

               apt-get –help

Another place to look for more information is the Ubuntu community how-to page for apt-get. This page gives a comprehensive view of apt-get, its options, and why things work the way they do.

Also, if you are interested in seeing how apt-get and Red Hat Package Manager work but don't have Linux on your machine, you can boot to that operating system with a USB stick.

Next Steps

Package managers make installing Linux programs easier

Alternative OSes, productivity suites grow their niche

Learn ways to install Linux on Windows 7 machines

Consider an open source OS after Windows XP

This was last published in February 2015

Dig Deeper on Alternative operating systems

PRO+

Content

Find more PRO+ content and other member only offers, here.

Join the conversation

5 comments

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

What are your experiences with apt-get and other Linux package manager tools?
Cancel
Apt-get certainly is an effective and reliable way to handle packages, especially considering the sizes of some and the setting up that would be needed otherwise.

Only once had it fail and had to download the key and manually import to complete the install. I did hear that some that use it fall foul of the usual dependency problems but that usually comes down to discipline and checking your version numbers.
Cancel
You mention KDE like a distribution with Debian and Ubuntu.  KDE is K Desktop Environment.  It's a desktop environment - yes, you have a choice of quite a few in the Linux world, unlike the Windows world where you are stuck with what they give you.  The default in Debian is Gnome, but you have a choice.

The difference between Ubuntu and Debian is that Ubuntu is more glamorous, but less stable then Debian.  The main line of Debian uses fully tested, and hence slightly older, software.  Ubuntu uses Debian's Testing line - software under evaluation which will move to stable if it passes evaluation.  For a business, use Debian.  I use Debian. Apt-get is a marvel.  Updating is fast, unintrusive and painless.
Cancel
Thanks for the clarification, @Epaminondas!
Cancel
I've been using Linux-based systems for a while, and had problems loading files using Red Hat Package Manager until it was recently modified for Linux.
Cancel

-ADS BY GOOGLE

SearchVirtualDesktop

SearchWindowsServer

SearchExchange

Close