How To Install Podman On CentOS Stream 9

how to install Podman

Now, we are living in a container world. So many applications even super Apps which is running on containers. Podman is Container management tool. In this short article we will learn how to install Podman on CentOS Stream 9 operating system. For this tutorial we will be using Podman version

Podman is

What is Podman? Podman is a daemonless container engine for managing containers, pods, and container images. Developed by Red Hat, it aims to provide a more secure and user-friendly alternative to Docker, particularly in environments where running a container daemon is not feasible or desirable. Unlike Docker, Podman operates using the libpod library, which allows it to run containers and pods without requiring a central daemon process.

Installing Podman on CentOS Stream 9

By default, Podman is available on the CentOS Stream 9 base repository, but if we need the latest Podman version, we just download from the Podman official website. Let’s install Podman using the following step below :

  1. Update Repository System
  2. Install Podman on CentOS Stream 9
  3. Using Podman

Update Repository System

We are advised to update our package repository system to ensure if we’re getting the latest version of repository packages including Podman . For this purpose we just submit following command line :

$ sudo dnf update

Installing Podman On CentOS Stream 9

In this stage, we will install Podman. For this purpose we just ht the command line :

$ sudo dnf install podman

Output :

 

ramansah@bckinfo ~]$ sudo dnf install podman
[sudo] password for ramansah:
Last metadata expiration check: 0:20:20 ago on Thu 09 May 2024 09:03:16 AM WIB.
Package podman-2:5.0.0-1.el9.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

After installing it, then we will verify by submitting command line podman --version, and the result as shown below

[ramansah@bckinfo ~]$ podman --version
podman version 4.9.4-dev

Testing Podman on CentOS Stream 9

At this stage, we will try to run Podman by pulling a simple images. There are will be several simple example to test Podman is running on the CentOS Stream :

  1. Pull an image and display an output on the screen
  2. Pull an image and do interactive task

Example : Pull an image and display an output on the screen

For this purpose we will download an official image and create a Container on it then we ill and output the words [Welcome to the Podman World] inside the Container.

We will follow a series step below :

$ sudo podman pull centos:stream9
$ sudo podman run centos:stream9 /bin/echo "Welcome to the Podman World"

Output :

[ramansah@bckinfo ~]$ sudo podman pull centos:stream9 
Resolved "centos" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull quay.io/centos/centos:stream9...
Getting image source signatures
Copying blob 93f7fd63a2b4 done |
Copying config af56dcd30a done |
Writing manifest to image destination
af56dcd30ab504ef698928ae0ff31a1a104eb0561c0f9023abea4abf8114781a

[ramansah@bckinfo ~]$ sudo podman run centos:stream9 /bin/echo "Welcome to the Podman World"
Welcome to the Podman World

Example : Pull an image and do interactive task

On this example we will using an i and t option when we are running the Podman.

$ podman run -it centos:stream9 /bin/bash

Output :

[ramansah@bckinfo ~]$ podman run -it centos:stream9 /bin/bash 
Resolved "centos" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull quay.io/centos/centos:stream9...
Getting image source signatures
Copying blob 93f7fd63a2b4 done |
Copying config af56dcd30a done |
Writing manifest to image destination
[root@5c00103c2c18 /]# uname -a
Linux 5c00103c2c18 5.14.0-437.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 9 12:57:02 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
[root@5c00103c2c18 /]#

For another variation, we will run container as Daemon, we will use itd option, as shown below:

[ramansah@bckinfo ~]$ podman run -itd centos:stream9 /bin/bash 
2e9a004d45e160a4b30679e32e75c1f68286a9568b9e9ccf7ae414ba1c1014e7

# show podman processes
[ramansah@bckinfo ~]$ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2e9a004d45e1 quay.io/centos/centos:stream9 /bin/bash 13 seconds ago Up 13 seconds admiring_goldwasser

# attach to container session
ramansah@bckinfo ~]$ podman exec -it 2e9a004d45e1 /bin/bash

# do interactive task
[root@2e9a004d45e1 /]# uname -a
Linux 2e9a004d45e1 5.14.0-444.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 26 18:25:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

#exit from container session
root@2e9a004d45e1 /]# exit
exit
[ramansah@bckinfo ~]$

#show the lates podman process
[ramansah@bckinfo ~]$ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2e9a004d45e1 quay.io/centos/centos:stream9 /bin/bash 8 minutes ago Up 8 minutes admiring_goldwasser

The Podman installation and testing has been shown in this short tutorial.

Conclusion

Podman represents a significant advancement in the field of container management, offering a compelling alternative to Docker with its daemonless architecture, enhanced security features, and seamless compatibility. Whether you’re a developer seeking greater flexibility and control over containerized applications or an administrator looking to optimize resource utilization and bolster security, Podman presents a compelling solution worthy of exploration. As containerization continues to gain momentum in modern software development and deployment workflows, Podman stands poised to play a pivotal role in shaping the future of container management.

(Visited 32 times, 1 visits today)

Leave a Reply

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