Table of Contents
In this article, I will take you through the steps to install Podman on Ubuntu 20.04 LTS but before that let's try to understand more about this application. According to Official documentation, Podman or Pod Manager Tool is an open source daemonless container engine for developing, managing, and running OCI Containers on our Linux System. The podman utility is also available as part of libpod Library. With the recent change in Docker License, podman can become a good alternative available to use in most of the Linux Systems including Ubuntu 20.04 LTS version.
How to Install Podman on Ubuntu 20.04 LTS
Also Read: 30 nmcli command examples in Linux(RHEL/CentOS) - Cheat Sheet
Step 1: Prerequisites
a) You should have a running Ubuntu 20.04 LTS
Server.
b) You should have sudo
or root
access to run privileged command.
c) You should have apt-get
, curl
and apt-key
utility installed in your Server.
Step 2: Source OS Release
First source the OS release by using source /etc/os-release
command as shown below.
root@cyberithub:~# source /etc/os-release
Step 3: Add Repository
Since podman is not available through default Ubuntu repository, we need to add the kubic repository to download the podman package. Then it can be installed through any of the ubuntu package manager like apt or apt-get. Use below command to add the repository.
root@cyberithub:~# echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /
Step 4: Add GPG Key
Then download and add the GPG key using below command. This is required to verify the integrity of the downloaded package.
root@cyberithub:~# curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key | sudo apt-key add - % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1093 100 1093 0 0 926 0 0:00:01 0:00:01 --:--:-- 925 OK
Step 5: Update Your Server
Next step is to update the package cache with all the package information from the newly added repository by using apt-get update
command. This step is required to make System aware of the package available in the added repository.
root@cyberithub:~# apt-get update
Hit:1 http://in.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 https://download.docker.com/linux/ubuntu focal InRelease
Hit:4 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease
Ign:5 http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu focal InRelease
Hit:6 https://dl.google.com/linux/chrome/deb stable InRelease
Ign:7 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 InRelease
Hit:8 https://artifacts.elastic.co/packages/oss-7.x/apt stable InRelease
Hit:9 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 Release
Hit:10 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:11 http://ppa.launchpad.net/hluk/copyq/ubuntu focal InRelease
Hit:12 https://repos.influxdata.com/ubuntu focal InRelease
Step 6: Upgrade Your Server
If required, you can also check if any of the packages needs to be upgraded to the latest version by using apt-get -y upgrade
command as shown below.
root@cyberithub:~# apt-get -y upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
linux-generic-hwe-20.04 linux-headers-generic-hwe-20.04 linux-image-generic-hwe-20.04
The following packages will be upgraded:
slirp4netns
1 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 707 kB of archives.
After this operation, 2,012 kB of additional disk space will be used.
Get:1 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04 slirp4netns 100:1.1.8-3 [707 kB]
Fetched 707 kB in 8s (88.1 kB/s)
(Reading database ... 232589 files and directories currently installed.)
Preparing to unpack .../slirp4netns_100%3a1.1.8-3_amd64.deb ...
Unpacking slirp4netns (100:1.1.8-3) over (0.4.3-1) ...
Setting up slirp4netns (100:1.1.8-3) ...
Processing triggers for man-db (2.9.1-1) ...
Step 7: Install Podman
Now you can download and install the podman package from the configured repository by using apt-get -y install podman
command as shown below. This will install the package along with all its dependencies.
root@cyberithub:~# apt-get -y install podman
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
catatonit conmon containernetworking-plugins containers-common criu crun fuse-overlayfs fuse3 libfuse3-3 libnet1 libprotobuf-c1 podman-machine-cni
podman-plugins uidmap
The following packages will be REMOVED:
fuse
The following NEW packages will be installed:
catatonit conmon containernetworking-plugins containers-common criu crun fuse-overlayfs fuse3 libfuse3-3 libnet1 libprotobuf-c1 podman podman-machine-cni
podman-plugins uidmap
0 upgraded, 15 newly installed, 1 to remove and 3 not upgraded.
Need to get 28.4 MB of archives.
After this operation, 145 MB of additional disk space will be used.
Step 8: Check Podman Version
After successful installation, you can verify the currently installed utility version by using podman --version
command. As you can see currently installed version is 3.4.2
.
root@cyberithub:~# podman --version
podman version 3.4.2
Step 9: Pull Images
Now that we have podman installed in our System, it is time to pull the first docker image from Registry by using podman pull
command. Here we are pulling the latest ubuntu image by using podman pull ubuntu
command as shown below.
root@cyberithub:~# podman pull ubuntu
Resolved "ubuntu" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull docker.io/library/ubuntu:latest...
Getting image source signatures
Copying blob ea362f368469 done
Copying config d13c942271 done
Writing manifest to image destination
Storing signatures
d13c942271d66cb0954c3ba93e143cd253421fe0772b8bed32c4c0077a546d4d
Step 10: List Images
Once image is pulled from the registry, you can check its repository details, image ID, time when the image was created and size by using podman images
command as shown below.
root@cyberithub:~# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/ubuntu latest d13c942271d6 11 days ago 75.2 MB
Step 11: Uninstall Podman
Once you are done with podman, you can remove it from your System by using apt-get remove podman
command as shown below.
root@cyberithub:~# apt-get remove podman Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: catatonit conmon containernetworking-plugins containers-common criu crun fuse-overlayfs libnet1 libprotobuf-c1 podman-machine-cni podman-plugins uidmap Use 'apt autoremove' to remove them. The following packages will be REMOVED: podman 0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded. After this operation, 80.2 MB disk space will be freed. Do you want to continue? [Y/n] Y (Reading database ... 232982 files and directories currently installed.) Removing podman (100:3.4.2-1) ... Processing triggers for man-db (2.9.1-1) ...