Cyberithub

How to Install Podman on RHEL/CentOS 7/8 [Step by Step]

Advertisements

In this article, I will take you through the steps to install podman on RHEL/CentOS 7/8. Podman is a daemonless, free and open source Linux based native tool designed to find, run, build, share and deploy applications using Open Containers Initiative (OCI) Containers and Container Images. In recent past, it has been emerged as a viable alternative of docker especially from the time since docker license has been updated for large business organizations. So anyone using docker container engine from long time will not face any difficulty in using podman as most of the functionality is almost similar. You can more about this on Podman official documentation.

How to Install Podman on RHEL/CentOS 7/8 [Step by Step]

How to Install Podman on RHEL/CentOS 7/8 

Also Read: How to manage multiple PostgreSQL Instances Using pgenv

Step 1: Prerequisites

a) You should have a running RHEL/CentOS 7/8 Server.

b) You should have yum or dnf utility available in your Server.

c) You should have sudo or root access to run privileged commands.

 

Step 2: Update Your Server

You can choose to download and install all the latest available updates from the enabled repositories by using yum update or dnf update command as shown below. If any package requires upgradation then you can also upgrade it by using yum upgrade or dnf upgrade command as shown below.

[root@cyberithub ~]# yum update
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 8.7 kB 00:00:00
* base: centos-hcm.viettelidc.com.vn
* epel: download.nus.edu.sg
* extras: centos-hcm.viettelidc.com.vn
* updates: centos-hcm.viettelidc.com.vn
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
hashicorp | 1.4 kB 00:00:00
packages-microsoft-com-prod | 3.0 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/5): epel/x86_64/updateinfo | 1.0 MB 00:00:00
(2/5): epel/x86_64/primary_db | 7.0 MB 00:00:00
(3/5): updates/7/x86_64/primary_db | 15 MB 00:00:01
(4/5): hashicorp/7/x86_64/primary | 97 kB 00:00:01
(5/5): packages-microsoft-com-prod/primary_db | 540 kB 00:00:02
hashicorp 690/690
Resolving Dependencies
--> Running transaction check
---> Package bpftool.x86_64 0:3.10.0-1160.59.1.el7 will be updated
---> Package bpftool.x86_64 0:3.10.0-1160.62.1.el7 will be an update
....................................

 

Step 3: Install EPEL Repo

If you don't have EPEL repo available, then install it by using yum install epel-release command as shown below.

[root@cyberithub ~]# yum install epel-release
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos-hcm.viettelidc.com.vn
* extras: centos-hcm.viettelidc.com.vn
* updates: centos-hcm.viettelidc.com.vn
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Installing:
epel-release noarch 7-11 extras 15 k

Transaction Summary
=============================================================================================================================================================
Install 1 Package

Total download size: 15 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-11.noarch.rpm | 15 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : epel-release-7-11.noarch 1/1
Verifying : epel-release-7-11.noarch 1/1

Installed:
epel-release.noarch 0:7-11

Complete!

 

Step 4: Install Podman

For RHEL/CentOS 7, Podman is available from default Extras repo so you can install it directly by using yum install podman command as shown below. If you are using CentOS 8, then podman is available from default AppStream repo so you can install it directly by using dnf install podman command. In RHEL 8, Podman is included in the container-tools module, along with Buildah and Skopeo so if you are using RHEL 8 based servers then you need to first use yum module enable -y container-tools:rhel8 command and then yum module install -y container-tools:rhel8 command for podman availability in your Server.

[root@cyberithub ~]# yum install podman
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos-hcm.viettelidc.com.vn
* epel: mirrors.ipserverone.com
* extras: centos-hcm.viettelidc.com.vn
* updates: centos-hcm.viettelidc.com.vn
Resolving Dependencies
--> Running transaction check
---> Package podman.x86_64 0:1.6.4-29.el7_9 will be installed
--> Processing Dependency: slirp4netns >= 0.4.0-1 for package: podman-1.6.4-29.el7_9.x86_64
--> Processing Dependency: runc >= 1.0.0-57 for package: podman-1.6.4-29.el7_9.x86_64
--> Processing Dependency: containers-common >= 0.1.29-3 for package: podman-1.6.4-29.el7_9.x86_64
--> Processing Dependency: containernetworking-plugins >= 0.8.1-1 for package: podman-1.6.4-29.el7_9.x86_64
--> Processing Dependency: nftables for package: podman-1.6.4-29.el7_9.x86_64
--> Processing Dependency: fuse-overlayfs for package: podman-1.6.4-29.el7_9.x86_64
--> Processing Dependency: container-selinux for package: podman-1.6.4-29.el7_9.x86_64
--> Processing Dependency: conmon for package: podman-1.6.4-29.el7_9.x86_64
................................................

 

Step 5: Check Version

After successful installation, you can check the current installed version by using podman --version command as shown below.

[root@cyberithub ~]# podman --version
podman version 1.6.4

 

Step 6: Check Pod Info

If you want to check complete podman system information then you need to use podman info command as shown below. Below output shows important information like host, current storage stats, configured container registries, and build of podman.

[root@cyberithub ~]# podman info
host:
BuildahVersion: 1.11.5
CgroupVersion: v1
Conmon:
package: conmon-2.0.8-1.el7.x86_64
path: /usr/bin/conmon
version: 'conmon version 2.0.8, commit: f85c8b1ce77b73bcd48b2d802396321217008762'
Distribution:
distribution: '"centos"'
version: "7"
MemFree: 176631808
MemTotal: 1927217152
OCIRuntime:
name: runc
package: runc-1.0.0-69.rc10.el7_9.x86_64
path: /usr/bin/runc
version: 'runc version spec: 1.0.1-dev'
...................................

 

Step 7: Pull Images

If you want to pull the images from default docker library then you need to use podman pull <image> syntax. In this example, we are pulling latest debian image by using podman pull debian command as shown below. If you do not specify any tag with the image, then by default it will pull the latest image.

[root@cyberithub ~]# podman pull debian
Trying to pull docker.io/library/debian...
Getting image source signatures
Copying blob dbba69284b27 done
Copying config d69c6cd3a2 done
Writing manifest to image destination
Storing signatures
d69c6cd3a20d21ec91b677c3bcd10d9975f4fe67eff81afb5a09bdef5134afeb

 

Step 8: List Images

You can list all the images by using podman images command as shown below.

[root@cyberithub ~]# podman images
REPOSITORY               TAG    IMAGE ID     CREATED     SIZE
docker.io/library/debian latest d69c6cd3a20d 11 days ago 129 MB

 

Step 9: Create a Container

You can now create an interactive container with bash shell running using debian image by running podman run --rm -it debian command as shown below.

[root@cyberithub ~]# podman run --rm -it debian
root@9f699d61d6e2:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

 

Step 10: Uninstall Podman

Once you are done using podman, you can also choose to uninstall it from your system by using yum remove podman or dnf remove podman command as shown below.

[root@cyberithub ~]# yum remove podman
Loaded plugins: fastestmirror, langpacks, product-id

Resolving Dependencies
--> Running transaction check
---> Package podman.x86_64 0:1.6.4-29.el7_9 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Removing:
podman x86_64 1.6.4-29.el7_9 @extras 58 M

Transaction Summary
=============================================================================================================================================================
Remove 1 Package

Installed size: 58 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : podman-1.6.4-29.el7_9.x86_64 1/1
Verifying : podman-1.6.4-29.el7_9.x86_64 1/1

Removed:
podman.x86_64 0:1.6.4-29.el7_9

Complete!

Leave a Comment