Jump toSuggest an edit

How to manage packages

Reviewed on 02 February 2024Published on 11 June 2021

Packages are archives containing binaries of pieces of software, configuration files and information about dependencies. Often, a package will represent a single application. A package manager is a tool to automate software installation, upgrading and configuration on your server. It keeps track of all the software packages installed and their various versions, and helps to remove software you no longer want.

On Debian and Ubuntu, you should use the APT (Advanced Package Tool) package manager.

Before you start

To complete the actions presented below, you must have:

  • A Dedibox account logged into the console
  • Created and installed a Dedibox server running on Ubuntu or Debian

How to update repositories

The package system is based on mirrors, generally indicated in /etc/apt/sources.list. When you want to update package information to get details about updated versions of packages or their dependencies, these sources will be checked. Update your package information with the following command:

sudo apt-get update

The output will vary, but here is one example:

Hit:1 stable InRelease
Hit:2 stable InRelease
Hit:3 focal InRelease
Hit:4 stable InRelease
Hit:5 stable InRelease
Hit:6 focal InRelease
Hit:7 focal-updates InRelease
Hit:8 focal InRelease
Hit:9 focal-backports InRelease
Hit:10 focal InRelease
Get:11 stable InRelease [4 502 B]
Hit:12 focal-security InRelease
Hit:13 focal InRelease

How to update packages

Now that your package manager knows the most recent packages available thanks to sudo apt-get update, it can compare that to what is already installed on your server. Use the following command to update your packages to any newer versions that are available:

sudo apt-get upgrade

You may see an output like the following:

Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
apt apt-utils base-files binutils bsdutils cpp-4.8 dh-python gcc-4.8
gcc-4.8-base initscripts iproute2 isc-dhcp-client isc-dhcp-common
libapt-inst1.5 libapt-pkg4.12 libasan0 libasn1-8-heimdal libatomic1
libblkid1 libdrm2 libgcc-4.8-dev libgomp1 libgssapi3-heimdal
libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal
libhx509-5-heimdal libitm1 libkrb5-26-heimdal libmount1 libquadmath0
libroken18-heimdal libstdc++6 libudev1 libuuid1 libwind0-heimdal login mount
passwd python-requests python-six python-urllib3 rsyslog sysv-rc
sysvinit-utils udev util-linux
47 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 21.0 MB of archives.
After this operation, 126 kB of additional disk space will be used.
Do you want to continue? [Y/n]

The package manager asks if you want to upgrade the packages installed on your system, where upgrades are available. To do so, press Y or O, depending on the language of your OS. The upgrade process may take some minutes to complete.


You do not always need to reboot after an update, but it is recommended when kernel updates have been made.

How to search for packages

You may want to search for specific software packages. In the example below, we search for the software MariaDB, the OpenSource version of MySQL:

apt-cache search mariadb

This gives the following output:

mariadb-client - MariaDB database client (metapackage depending on the latest version)
mariadb-client-5.5 - MariaDB database client binaries
mariadb-client-core-5.5 - MariaDB database core client binaries
mariadb-common - MariaDB common metapackage
mariadb-server - MariaDB database server (metapackage depending on the latest version)
mariadb-server-5.5 - MariaDB database server binaries
mariadb-server-core-5.5 - MariaDB database core server files
mariadb-test - MariaDB database regression test suite (metapackage for the latest version)
mariadb-test-5.5 - MariaDB database regression test suite

We can see that several versions are available. In general, it is recommended to choose the “metapackage” when available. Here, we can see that is mariadb-server. The metapackages always install the latest available version, compared to the classic packages (mariadb-server-5.5), which will install version 5.5 and remain on this version.

How to install a package

Use the following command to install a package:

sudo apt-get install PACKAGE

To continue with the MariaDB example, type:

sudo apt-get install mariadb-server

How to keep your system tidy

When you want to install an APT package, it often offers to install others at the same time. This is because of dependencies. A dependency is a small additional piece of software required by your package to function. Over time, however, it may be that some dependencies become unused, for example, following a chance of dependency for your package.

You can uninstall all unused dependencies with the following command:

sudo apt-get autoremove

How to uninstall a package

If you installed a package just for test purposes or realized you installed the wrong package, it is easy to remove it. Use the following command:

sudo apt-get remove PACKAGE

If you want to remove all dependencies that were installed with the package at the same time, you can add autoremove:

sudo apt-get autoremove PACKAGE
See also
How to change the root passwordHow to change the language of a Windows Server
Docs APIScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCarreer
© 2023-2024 – Scaleway