How To Install cloud-init on Ubuntu 20.04

In this tutorial we learn how to install cloud-init on Ubuntu 20.04. cloud-init is initialization and customization tool for cloud instances initialization and customization tool for cloud instances

Introduction

In this tutorial we learn how to install cloud-init on Ubuntu 20.04.

What is cloud-init

cloud-init is:

Cloud-init is the industry standard multi-distribution method for cross-platform cloud instance initialization. It is supported across all major public cloud providers, provisioning systems for private cloud infrastructure, and bare-metal installations.

Cloud instances are initialized from a disk image and instance data:

  • Cloud metadata
  • User data (optional)
  • Vendor data (optional)

Cloud-init will identify the cloud it is running on during boot, read any provided metadata from the cloud and initialize the system accordingly. This may involve setting up the network and storage devices to configuring SSH access key and many other aspects of a system. Later on the cloud-init will also parse and process any optional user or vendor data that was passed to the instance. Task: cloud-image, ubuntu-core

Package: cloud-init Architecture: all Version: 20.1-10-g71af48df-0ubuntu5 Priority: extra Section: admin Origin: Ubuntu Maintainer: Ubuntu Developers [email protected] Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 2013 Depends: cloud-guest-utils | cloud-utils, isc-dhcp-client, iproute2, netplan.io, procps, python3, python3-requests, python3-serial, debconf (>= 0.5) | debconf-2.0, python3-configobj, python3-jinja2, python3-jsonpatch, python3-jsonschema, python3-oauthlib, python3-six, python3-yaml, python3:any Recommends: eatmydata, gdisk, software-properties-common Filename: pool/main/c/cloud-init/cloud-init_20.1-10-g71af48df-0ubuntu5_all.deb Size: 406084 MD5sum: df0ea748953acde51a8cb29c18b3df8b SHA1: 9292876ce4fe3166092f3dec24c23af64150eeff SHA256: ff86293529a72837b4f0a130dec7c272fd5a3a10a8be47dd569d575dbf14529e Homepage: https://cloud-init.io/ Description-en: initialization and customization tool for cloud instances Cloud-init is the industry standard multi-distribution method for cross-platform cloud instance initialization. It is supported across all major public cloud providers, provisioning systems for private cloud infrastructure, and bare-metal installations.

Cloud instances are initialized from a disk image and instance data:

  • Cloud metadata
  • User data (optional)
  • Vendor data (optional)

Cloud-init will identify the cloud it is running on during boot, read any provided metadata from the cloud and initialize the system accordingly. This may involve setting up the network and storage devices to configuring SSH access key and many other aspects of a system. Later on the cloud-init will also parse and process any optional user or vendor data that was passed to the instance. Task: cloud-image, ubuntu-core

There are three methods to install cloud-init 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 cloud-init Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install cloud-init

Install cloud-init Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install cloud-init

Install cloud-init 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 cloud-init using aptitude by running the following command:

sudo aptitude -y install cloud-init

How To Uninstall cloud-init on Ubuntu 20.04

To uninstall only the cloud-init package we can use the following command:

sudo apt-get remove cloud-init

Uninstall cloud-init And Its Dependencies

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

sudo apt-get -y autoremove cloud-init

Remove cloud-init Configurations and Data

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

sudo apt-get -y purge cloud-init

Remove cloud-init configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge cloud-init

References

Summary

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