Are you familiar with the apt-get command?

The apt-get (Advanced Package Tool) command is an advanced package manager. It can use local or remote files to install or update packages. This way it is possible to update the entire Debian system via ftp or http. This manager also maintains information about packages and their dependencies.

Due to its ease of operation, apt-get is the preferred method for manipulating packages. This utility offers dozens of options configured in the /etc/apt/apt.conf file.

The /etc/apt/sources.list file contains the locations where apt-get will find the packages, the verified distribution (stable, testing, unstable, Woody, Sarge) and the section that will be copied (main, non-free, contrib, non-US).

Below is a simple example of the /etc/apt/sources.list file with an explanation of the sections:

deb http://www.debian.org/debian stable main contrib non-free

deb http://nonus.debian.org/debian-non-US stable non-US

In the /etc/apt/apt.conf file we can specify options that will modify the behavior of the apt-get program when manipulating packages.

apt-get uses a list of packages to check whether existing packages on the system need to be updated or not. The newest list of packages is copied using the apt-get update command.

Apt-get is very useful because the administrator does not have to manually copy the package he wishes to install from the Internet, much less deal with the dependencies, as long as what he needs is in the repositories indicated on sources.list.

The most common options for this utility are:

-d: Download the files but don’t install. It is useful for downloading large volumes of packages for later installation;

-s: Simulates the installation of the packages, but does not make modifications;

-y: Answer in the affirmative for all questions asked during the installation/uninstallation process of the packages.

The most common commands are:

  • dist-update: This command automatically updates the Debian system;
  • install: This command installs a certain package specified by name;
  • remove: This command removes a specific package specified by name;
  • update: This command makes a list of all available packages. The process is done automatically before any modification to the packages;
  • upgrade: This command is used to safely update the system because it does not install packages that may cause a conflict or failure in the configuration files.

Examples:

# apt-get install airsnort

Install the airsnort.x.y.deb package. This command accepts installing more than one package by separating names by spaces. You only need to specify the package name, without version (X), revision (Y), and suffix (.deb).

If necessary, apt-get will automatically install the dependencies necessary for the correct functioning of a package.

apt-get can update your entire distribution in a smart and secure way. It reads the list of packages available on the remote server, checks which are installed and their versions, and updates the old packages.

# apt-get upgrade

The files can be copied via FTP, http, local copy of the files to the hard disk or CD-ROM

Learn much more about Linux in our online course. You can enroll here with a free 7-day trial. If you already have an account, you can log in here.

Did you like it? Share 🙂

Uirá Endy Ribeiro

Uirá Endy Ribeiro is a Software Developer and Cloud Computing Architect with a 23-year career. He has master's degrees in computer science and fifteen IT certifications and is the author of 11 books recognized in the IT world market. He is also Director at Universidade Salgado de Oliveira and Director of the Linux Professional Institute - LPI Director's Board.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Need help?