Jump toUpdate content
How to manage packages
Packages are archives containing binaries of pieces of software, along with configuration files and information about dependencies. Often, a package will represent a single application. A package manager is a tool to automate the installation, upgrading and configuration of software on your server, via such packages. It keeps track of all the software packages installed and their various versions, and also helps you remove software that you no longer want.
On Debian and Ubuntu, you should use the APT (Advanced Package Tool) package manager.
- You have an account and are logged into the Dedibox Console
- You have a Dedibox server
- Your server is installed with 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 http://dl.google.com/linux/chrome/deb stable InReleaseHit:2 https://maven.localazy.com/repository/apt stable InReleaseHit:3 https://download.docker.com/linux/ubuntu focal InReleaseHit:4 http://packages.microsoft.com/repos/code stable InReleaseHit:5 https://dl.yarnpkg.com/debian stable InReleaseHit:6 http://fr.archive.ubuntu.com/ubuntu focal InReleaseHit:7 http://fr.archive.ubuntu.com/ubuntu focal-updates InReleaseHit:8 http://ppa.launchpad.net/alex-p/aegisub/ubuntu focal InReleaseHit:9 http://fr.archive.ubuntu.com/ubuntu focal-backports InReleaseHit:10 https://deb.nodesource.com/node_16.x focal InReleaseGet:11 https://repo.skype.com/deb stable InRelease [4 502 B]Hit:12 http://security.ubuntu.com/ubuntu focal-security InReleaseHit:13 http://ppa.launchpad.net/peek-developers/stable/ubuntu 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... DoneReading package lists... DoneBuilding dependency treeReading state information... DoneCalculating upgrade... DoneThe following packages will be upgraded:apt apt-utils base-files binutils bsdutils cpp-4.8 dh-python gcc-4.8gcc-4.8-base initscripts iproute2 isc-dhcp-client isc-dhcp-commonlibapt-inst1.5 libapt-pkg4.12 libasan0 libasn1-8-heimdal libatomic1libblkid1 libdrm2 libgcc-4.8-dev libgomp1 libgssapi3-heimdallibhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdallibhx509-5-heimdal libitm1 libkrb5-26-heimdal libmount1 libquadmath0libroken18-heimdal libstdc++6 libudev1 libuuid1 libwind0-heimdal login mountpasswd python-requests python-six python-urllib3 rsyslog sysv-rcsysvinit-utils udev util-linux47 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
O, depending on the language of you 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 binariesmariadb-client-core-5.5 - MariaDB database core client binariesmariadb-common - MariaDB common metapackagemariadb-server - MariaDB database server (metapackage depending on the latest version)mariadb-server-5.5 - MariaDB database server binariesmariadb-server-core-5.5 - MariaDB database core server filesmariadb-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 dependecies 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