How To Install systemd-container on Ubuntu 20.04

In this tutorial we learn how to install systemd-container on Ubuntu 20.04. systemd-container is systemd container/nspawn tools systemd container/nspawn tools

Introduction

In this tutorial we learn how to install systemd-container on Ubuntu 20.04.

What is systemd-container

systemd-container is:

This package provides systemd’s tools for nspawn and container/VM management:

  • systemd-nspawn
  • systemd-machined and machinectl
  • systemd-importd
  • systemd-portabled and portablectl

Package: systemd-container Architecture: amd64 Version: 245.4-4ubuntu3 Multi-Arch: foreign Priority: optional Section: admin Source: systemd Origin: Ubuntu Maintainer: Ubuntu Developers [email protected] Original-Maintainer: Debian systemd Maintainers [email protected] Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 1191 Depends: libacl1 (>= 2.2.23), libbz2-1.0, libc6 (>= 2.28), libcurl3-gnutls (>= 7.16.3), libgcrypt20 (>= 1.8.0), liblzma5 (>= 5.1.1alpha+20120614), libseccomp2 (>= 2.3.1), libselinux1 (>= 2.1.9), systemd (= 245.4-4ubuntu3), zlib1g (>= 1:1.1.4), dbus Recommends: libnss-mymachines Filename: pool/main/s/systemd/systemd-container_245.4-4ubuntu3_amd64.deb Size: 317240 MD5sum: f67b429ff0cf3fb51bfdd18c2785b445 SHA1: 0eb815d5050e8c25c635f33870d72b5ae9357dbb SHA256: 54ce1e0c2d1ea5d43db6f5a02b9f5b3731d9e1c2c653ee2c835aae89b899a664 Homepage: https://www.freedesktop.org/wiki/Software/systemd Description-en: systemd container/nspawn tools This package provides systemd’s tools for nspawn and container/VM management:

  • systemd-nspawn
  • systemd-machined and machinectl
  • systemd-importd
  • systemd-portabled and portablectl

There are three methods to install systemd-container on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install systemd-container Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install systemd-container using apt-get by running the following command:

sudo apt-get -y install systemd-container

Install systemd-container Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install systemd-container using apt by running the following command:

sudo apt -y install systemd-container

Install systemd-container Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install systemd-container using aptitude by running the following command:

sudo aptitude -y install systemd-container

How To Uninstall systemd-container on Ubuntu 20.04

To uninstall only the systemd-container package we can use the following command:

sudo apt-get remove systemd-container

Uninstall systemd-container And Its Dependencies

To uninstall systemd-container and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove systemd-container

Remove systemd-container Configurations and Data

To remove systemd-container configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge systemd-container

Remove systemd-container configuration, data, and all of its dependencies

We can use the following command to remove systemd-container configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge systemd-container

References

Summary

In this tutorial we learn how to install systemd-container package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.