Best Steps To Install Podman on Ubuntu 22.04

Posted on

Best Steps To Install Podman on Ubuntu 22.04

Best Steps To Install Podman on Ubuntu 22.04

In this guide on the Orcacore website, you will learn the Best Steps To Install Podman on Ubuntu 22.04. Podman is an open-source, Linux-native tool designed to develop, manage, and run containers and pods under the Open Container Initiative (OCI) standards. Presented as a user-friendly container orchestrator developed by Red Hat, Podman is the default container engine in RedHat 8 and CentOS 8.

It is one of a set of command-line tools designed to handle different tasks of the containerization process, that can work as a modular framework.

To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with Ubuntu 22.04.

1. Set up Podman on Ubuntu 22.04

By default, Podman packages aren’t available in the default Ubuntu 22.04 repository. So you need to manually add the Podman repository. Let’s explore the Best Steps To Install Podman on Ubuntu 22.04.

First, update and upgrade your local package index with the following command:

sudo apt update && sudo apt upgrade

Add Podman Repository

Then, use the following command to add the Podman repository:

echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_22.04/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list

Add Podman GPG Key

Next, run the command below to add the GPG key:

curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_22.04/Release.key" | sudo apt-key add -

Run the system update again:

sudo apt update

Install Podman Ubuntu 22

Finally, use the command below to install Podman:

sudo apt install podman -y

Verify your installation by checking its version:

podman -v
**Output**
podman version 3.4.4

To get full information about Podman, you can use:

podman info
Install Podman on Ubuntu 22.04

2. How To Use Podman on Ubuntu 22.04

Now that you have learned the Best Steps To Install Podman on Ubuntu 22.04, let’s see its basic usage.

Search and pull images with Podman

Just like Docker, you can use the Podman command line to search Images but from different repositories.

For example, if you want to install a Ubuntu container using Podman, then you can search what are the images available through the different repositories.

podman search ubuntu

Then, you can download and pull images with the following command:

podman pull ubuntu

List all Images with Podman

If you have downloaded multiple images and now want to see what are the available images on your system, you can list all of them using the following command:

podman images

In my case:

List all Images with Podman

Create a Container with Podman

Once you have the image of the application that you want, you can create a container with it. Here we have downloaded the Ubuntu image with Podman. Now we will show how to use it to create a container using Ubuntu Image.

To do this, you can use the following command:

podman run -dit --name orca ubuntu

Note: –name is a parameter to give the container whatever friendly name you want to assign.

To access your Container command line, use the following command:

podman attach orca

You will see that your command prompt changes to your container ID:

reita@048260657f81:/#

To start your container, you can use the command below:

podman start container-id or name

To stop your container, you can use the following command:

podman stop container-id or name

For more information, you can visit the Podman Documentation page

Conclusion

At this point, you have learned the Best Steps To Install Podman on Ubuntu 22.04. You can easily use Podman to manage your containers. Hope you enjoy it.

You may also interested in these articles:

How To Install Joomla on Ubuntu 22.04

How To Install MySQL on Ubuntu 22.04

Set up PiVPN on Ubuntu 22.04

Install Postfix Mail Server on Ubuntu 22.04

Alternative Solutions for Installing Podman on Ubuntu 22.04

While the provided method of adding the openSUSE repository is a valid approach to installing Podman, alternative methods exist. Here are two different approaches you can consider:

1. Using apt-fast for Faster Downloads

The standard apt package manager is effective, but its download speeds can sometimes be a bottleneck. apt-fast is a wrapper for apt that can significantly speed up package downloads by using multiple connections. This approach builds on the original method, making it faster, especially if you have a high-bandwidth internet connection.

Installation and Usage:

First, install apt-fast:

sudo add-apt-repository ppa:apt-fast/stable
sudo apt update
sudo apt install apt-fast -y

Then, use apt-fast instead of apt for the update and install commands:

sudo apt-fast update && sudo apt-fast upgrade

Next, add the Podman repository as before:

echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_22.04/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list

Add the GPG key:

curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_22.04/Release.key" | sudo apt-key add -

Update the package list:

sudo apt-fast update

Finally, install Podman using apt-fast:

sudo apt-fast install podman -y

By utilizing apt-fast, you accelerate the download process, which can be particularly beneficial when dealing with larger packages or slower network connections. This is not a fundamentally different method, but an enhancement to the original one.

2. Using a Snap Package (Less Recommended)

Snap packages are containerized software packages that are easy to install and update. While Podman isn’t officially available as a Snap from the Podman project, community-maintained Snap packages might exist. However, this approach is generally not recommended for Podman, as Snaps can sometimes introduce overhead and compatibility issues compared to native package installations. Moreover, relying on community-maintained Snaps carries the risk of delayed updates or potential security vulnerabilities. Proceed with caution and only if you understand the risks.

Disclaimer: The following example assumes a hypothetical community Snap package exists. Before proceeding, verify the existence and trustworthiness of such a package.

Hypothetical Installation:

sudo snap install podman --channel=latest/stable  # Hypothetical command

After the hypothetical installation, verify its version:

podman -v

Explanation:

  • sudo snap install podman --channel=latest/stable: This command attempts to install Podman from the Snap Store, specifying the latest/stable channel for the most recent stable release.

Why this is less recommended:

  • Performance Overhead: Snaps can introduce a layer of containerization that can slightly impact performance compared to native packages.
  • Security Concerns: Community-maintained Snaps might not be as rigorously vetted as official packages, potentially introducing security risks.
  • Update Delays: Updates to Snap packages might lag behind updates to the official Podman releases.
  • Compatibility Issues: Snaps can sometimes have compatibility issues with other system components.

Therefore, while the Snap method offers a simplified installation process, the potential drawbacks make it a less desirable option for installing Podman on Ubuntu 22.04, especially when the recommended method using the openSUSE repository is reliable and well-supported. The Best Steps To Install Podman on Ubuntu 22.04 is still the first method.

Leave a Reply

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