Math-Linux.com

Knowledge base dedicated to Linux and applied mathematics.

Home > Linux > Tutorials > How to install software packages on Debian-Ubuntu: apt-get

How to install software packages on Debian-Ubuntu: apt-get

All the versions of this article: [English] [français]

In this tutorial, we shall see how to install software packages under Debian and Ubuntu. In the program, we shall have a look at already-installed packages, search packages, information related to software packages, how to update packages and the software list.

List of installed software packages

To visualize the list of installed packages, we use the following command

~# dpkg-query -W

To visualize an installed package whose name is scilab for example, we use the previous command and a redirection (or pipeline) to the ’grep’ command. Practically, we have:

~# dpkg-query -W | grep -i scilab
scilab  4.0-2
scilab-bin      4.0-2
scilab-doc      4.0-2

Description of installed software packages

The description of the set of installed packages is obtained via the command

~# dpkg -l

List of available software packages

The list of available packages is obtained as follows:

~# apt-cache pkgnames

We clearly see that the list is not in alphabetical order. To resolve this issue, we redirect and sort the output:

~# apt-cache pkgnames | sort

Searching a software package: apt-cache search

To search a software package, we proceed as follows:

~# apt-cache search flashplayer
flashplayer-mozilla - Macromedia Flash Player

This command displays software packages containing the expression
flashplayer.

Properties and information of a software: apt-cache show

To display information related to a package, for instance the
flashplayer-mozilla package, we proceed as follows:

~# apt-cache show flashplayer-mozilla
Package: flashplayer-mozilla
Priority: optional
Section: multiverse/web
Installed-Size: 1528
Maintainer: Christian Marillat <marillat@debian.org>
Architecture: i386
Source: install-flash-player
Version: 6.0.79-0.2
Depends: libc6 (>= 2.4-1), libx11-6, libxext6, libxt6, zlib1g (>= 1:1.2.1), mozilla-browser | www-browser
Conflicts: flashplugin
Filename: pool/multiverse/i/install-flash-player/flashplayer-mozilla_6.0.79-0.2_i386.deb
Size: 702000
MD5sum: bfc6eba2b01041876f30c87b930f8d0d
SHA1: f1fa7ab3e931bc411a3713bdaf17c8976dbc24aa
SHA256: 3bd0597a5fc491aa7c2cf2694dd4737f5f1af2e8e9175268062204a6e79db13b
Description: Macromedia Flash Player
The Flash Player lets you experience animation and entertainment in your
Mozilla web browser.
Bugs: mailto:ubuntu-users@lists.ubuntu.com
Origin: Ubuntu

Note that the exact name of the package should be entered ! For example,

~# apt-cache show flash
W: the package flash could not be found
E: No package has been found

does not yield any result since flash is not he name of a package.

Installing a software: apt-get install

Assume we want to install firefox. We type:

~# apt-get install firefox

Removing a software: apt-get remove

To uninstall a package, we can proceed in two ways. Either 1) we uninstall only the software or 2) the software and its configuration files. In the first case, assuming we want to uninstall the mplayer software, we type:

~# apt-get remove mplayer

In the second case, if we want to uninstall both ’mplayer’ and its configuration files, we type:

~# apt-get remove --purge mplayer

Updating the software list: apt-get update

Updating a list of software is not the same as updating the software per se. Only the list is actually updated:

~# apt-get update

Updating the software: apt-get upgrade

The upgrade command installs the most recent versions of all packages on the system.

~# apt-get upgrade

To simulate an update installation, i.e. to see which software will be updated, we type:

~# apt-get -s upgrade

Smart software update: apt-get dist-upgrade

The dist-upgrade command has the same effect as the ’upgrade’ except that a smart management is used in changes of dependencies in new versions: conflict resolution and discarding less important packages for more important ones, for example.

~# apt-get dist-upgrade

Any message or comments?

comments powered by Disqus