How to update Ubuntu from terminal

Using the terminal, instead of the graphical tool, makes it easier to detect errors.

Although the use of the graphical interface is very comfortable, knowing how to update Ubuntu from the terminal allows us greater versatility when determining the update parameters and how to detect and correct errors.

In this article we will learn what they are. basic commands for software update on Ubuntu, both from the repositories and with the self-contained Snap and Flatpak packages.

Ubuntu repositories

In Ubuntu there are three basic ways to install programs:

  • Installation from repositories using a package manager.
  • Manual installation.
  • Compilation.

Since, with the last two methods, the update is basically installing the new version, we will concentrate on the first method.

Installation from repositories

In Linux, the term repository refers to the place from where the operating system gets its applications (including other programs necessary for its operation) and updates. These applications are hosted on a remote server managed by those responsible for each distribution or by third parties that are accessed using a package manager.

The use of official repositories guarantees the compatibility of installed applications and the permanent availability of updates. In addition, it provides a higher level of protection against the introduction of malicious software. However, the official repositories do not always have the most current versions, so if we need them, we should opt for other installation alternatives.

Ubuntu repositories are the first way to get software updates

By editing the list of repositories using a text editor, we can tell Ubuntu where to download updates from.

The Ubuntu repositories are:

  • Main:  It is the only repository that is activated by default. As its name in English indicates, it is the main repository and is composed only of free and open source software and updates are carried out by the developers of Canonical (The company behind Ubuntu)
  • World: It also contains only free and open source software. It differs from the Main repository in that it is not Canonical that provides the programs and updates, but rather third parties.
  • Multiverse: In this repository there are programs that are not free licenses and there is no support for updates.
  • restricted:  This includes proprietary programs necessary for a better interaction between the operating system and the hardware, such as drivers provided by the manufacturers.
  • Partner:  It is a collection of proprietary software that Ubuntu provides by agreement with the developer companies.

The commands to install these repositories are:
sudo add-apt-repository universe
sudo add-apt-repository multiverse
sudo add-apt-repository restricted

Regarding the partner repository, it was removed in Ubuntu 22.04. I mention it because the extended support version 20.04 continues to support it. This version will be available until 2025.

The way to activate the partner repository is slightly more complex. We open the terminal and write:
sudo nano /etc/apt/sources. List

We are looking for a line like this

#deb http://archive.canonical.com/ubuntu... partner
We delete the pound symbol at the beginning. We save with shift key + O and exit with shift key + X.

Then we update the list of repositories with:

sudo apt update

Although Ubuntu is ditching them in favor of Snap packages, personal package archives (ppa) are still used. When installing the updates, Ubuntu will compare in which repository the most current version is located and will install it, no matter which one it comes from.

To add the repository, use the command:

sudo add-apt-repositorio nombre_del_repositorio.

For example, to install Blender on Ubuntu 20.04:

sudo add-apt-repository ppa:thomas-schiex/blender

Snap and Flatpak

Logo of Linux distributions that support the Platpak format
Related article:
Comparing Snap and Flatpak. Advantages and disadvantages

For the installation of programs not included in the official repositories, Linux distributions are opting for so-called self-contained applications. These are applications that include all the necessary libraries for their operation. The advantage of this type of applications is that they can be updated without making any changes to the operating system. This allows third-party developers to offer the latest versions of their programs without waiting for Ubuntu to implement the necessary changes.

There are two installation systems that can be installed. Both can coexist with each other and with the traditional system program installation.

Snap is the system developed by Ubuntu and no additional steps are required to use it. In the case of Flatpak we must write the commands:

sudo apt inflatpacklatpak

flatpack remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

How to update Ubuntu from terminal

The Snap Store is an Alternative Way to Get and Update Software on Linux

The Snap store is increasingly replacing the personal package archives (ppa) and the partner repository as a way to offer packages not officially supported by Ubuntu.

To update Ubuntu we must first make sure that the list of repositories is up to date. Although only if we add some repository. We do it with the command:

sudo apt update

Then we update to the latest available version of the installed programs with:

sudo apt upgrade

To update the Snap packages we can use the following commands

sudo snap refresh to update all installed snap packages

o

sudo snap refresh nombre_del_paquete to update a specific program.

In the case of Flatpak packages the commands are:

flatpack update to update all installed packages

o

flatpack update nombre_del_paquete to update a specific one.


Leave a Comment

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

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.