Debian / Ubuntu package management

  • You have an account at
  • You have a Dedibox dedicated server
  • The server is installed with Debian or Ubuntu

On Debian & Ubuntu, you need to use the package manager APT to manage your packages.

Packets are pre-compiled software, that is ready to use with your operating system.

In this tutorial, we will have a look on the basic commands to maintain your system.

Update of the repositorys

The package system is based on mirrors, generally indicated in /etc/apt/sources.list. When you want to do an update of your packages, you need to update the list of available packages in a first step.

This is done with the following command:

sudo apt-get update
Ign trusty InRelease
Atteint trusty Release.gpg                            
Atteint trusty Release                                
Ign trusty InRelease                                  
Ign stable InRelease                                      
Atteint trusty/main Sources                           
Ign trusty InRelease                                  
Atteint trusty/main amd64 Packages                    
Atteint trusty Release.gpg                            
Atteint trusty/main i386 Packages                     
Atteint trusty Release.gpg                            

Once this step is finished, you can continue with the update of your packages.

Updating packages

The APT system is well done and knows all that is already installed via this system. If you demand an update of the packages, it compares the list of installed packages with the list of available ones on the mirrors.

If there are newer packages, it will propose you to update them.

To do an update type:

sudo apt-get upgrade
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 proposed packages are depending on the ones already installed on your server and the updates available.

To launch the update, you need to confirm it by pressing “Y” or “O” (Depending on the language of your OS). Once the update process is launched, you only need to wait some minutes for it to finish.

It is not always required to reboot after an update, but it is recommended when kernel updates have been made.
Search for packages

If you want to install some specific packages, you can search how they are named or simply see, if they exist.

For exapmle, I want to search the software MariaDB, the OpenSource version of MySQL.

apt-cache search mariadb
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

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

Package installation

To install a package, nothing but the following command is required:

sudo apt-get install PACKAGE

If we continue with our example of MardiaDB, we need to type:

sudo apt-get install mariadb-server
Keeping your system tidy

As you can see, when you want to install an APT package, it often offers to install others simultaneously.

This is called dependencies.

A dependence is a small software which is required by your package to function.

Over the time it may be that some dependences become unused, for example following the change of a dependence of your package.

It is possible to uninstall all unsed dependencies as following:

sudo apt-get autoremove
Deinstallation of a package

You installed a package just for doing some tests, or you have installed the wrong one?

It is easily possible to remove it.

Here the command:

sudo apt-get remove PACKAGE
It is also possible to remove all the dependencies installed with the package wuth the command autoremove: sudo apt-get autoremove PACKAGE