Thursday, December 26, 2024
Google search engine
HomeGuest BlogsHow To Install Podman on Debian 12/11/10/9

How To Install Podman on Debian 12/11/10/9

Podman is a daemonless container engine for developing, managing, and running OCI Containers on your Linux System. It was created to replace Docker which requires a daemon running in the background. This guide will walk you through the installation of Podman on Debian 12/11/10/9 Linux machines.

PodmanĀ uses container runtimes as well for example runc but the launched containers are direct descendants of the podman process. It is part of theĀ libpodĀ library

Step 1: Update System

Update package index:

sudo apt -y update && sudo apt -y upgrade

After the upgrade we always recommend a system reboot if this is a requirement.

[ -f /var/run/reboot-required ] && sudo reboot -f

Step 2: Install pre-requisites

In this guide, we will use ansible role which automates the installation of Podman on Debian system. If ansible is already installed on the system please remove it.

sudo apt update
sudo apt remove ansible

Install other tools required for the installation to work.

sudo apt install vim git uidmap fuse3 fuse-overlayfs

If planning to build from source in future you can install all dev tools

sudo apt install \
  btrfs-progs \
  git \
  golang-go \
  go-md2man \
  iptables \
  libassuan-dev \
  libbtrfs-dev \
  libc6-dev \
  libdevmapper-dev \
  libglib2.0-dev \
  libgpgme-dev \
  libgpg-error-dev \
  libprotobuf-dev \
  libprotobuf-c-dev \
  libseccomp-dev \
  libselinux1-dev \
  libsystemd-dev \
  pkg-config \
  runc \
  uidmap

Install Python and pip tools on your Debian system

### Python 3 ###
sudo apt install python3 python3-pip
sudo  pip3 install --upgrade pip

### Python 2 ###
sudo apt install python2 python2-pip
sudo  pip install --upgrade pip

Step 3: Install Podman on Debian

We can install Ansible from APT repository or using ansible depending on your preference.

Method 1: InstallPodman on Debian from APT repos

There are two main APT repositories containing Podman Deb packages.

Option 1) Using alvistack APT repository

An alternative Debian package installation option is from alvistack package repos. Start with repository key importation process.

source  /etc/os-release
wget http://downloadcontent.opensuse.org/repositories/home:/alvistack/Debian_$VERSION_ID/Release.key -O alvistack_key
cat alvistack_key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/alvistack.gpg  >/dev/null

Add the repo to your system.

echo "deb http://downloadcontent.opensuse.org/repositories/home:/alvistack/Debian_$VERSION_ID/ /" | sudo tee  /etc/apt/sources.list.d/alvistack.list

You should be able to see the repository in the list when you run apt update command:

$ sudo apt update
Hit:1 http://security.debian.org/debian-security bullseye-security InRelease
Hit:2 http://deb.debian.org/debian bullseye InRelease
Hit:3 http://deb.debian.org/debian bullseye-updates InRelease
Get:4 http://downloadcontent.opensuse.org/repositories/home:/alvistack/Debian_11  InRelease [1538 B]
Hit:5 http://deb.debian.org/debian bullseye-backports InRelease
Get:7 http://downloadcontent.opensuse.org/repositories/home:/alvistack/Debian_11  Packages [197 kB]
Fetched 200 kB in 1s (342 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done

Install Podman on Debian system using apt package manager

sudo apt install podman python3-podman-compose 

We can see the version of Podman installed by running the commands below:

$ podman version
Client:       Podman Engine
Version:      4.6.1
API Version:  4.6.1
Go Version:   go1.21.0
Built:        Thu Jan  1 00:00:00 1970
OS/Arch:      linux/amd64

Option 2) Using Kubic libcontainers repository

Import repository GPG key:

sudo apt update && sudo apt install wget lsb-release -y
source  /etc/os-release
wget https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_$VERSION_ID/Release.key
cat Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/libcontainers.gpg  >/dev/null

Add Kubic libcontainers repository to your Debian system.

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

Check if the repository added is visible in the list.

$ sudo apt update
Hit:1 http://deb.debian.org/debian bullseye InRelease
Hit:2 http://deb.debian.org/debian bullseye-updates InRelease
Hit:3 http://security.debian.org/debian-security bullseye-security InRelease
Hit:4 http://deb.debian.org/debian bullseye-backports InRelease
Get:5 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_11  InRelease [1634 B]
Get:6 https://downloadcontent.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_11  Packages [34.4 kB]
Fetched 36.0 kB in 1s (62.6 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done

Perform system upgrade:

sudo apt update && sudo apt -y full-upgrade
[ -f /var/run/reboot-required ] && sudo reboot -f

Then final step is the installation of Podman on Debian 11/10/9:

sudo apt install podman -y

Check version installed to confirm this was successful.

$ podman version
Version:      3.4.2
API Version:  3.4.2
Go Version:   go1.15.2
Built:        Thu Jan  1 00:00:00 1970
OS/Arch:      linux/amd64

Method 2: Install Podman on Debian using Ansible

For Ansible automated way, start by cloning Ā Ansible RoleĀ from Github using git command:

mkdir -p ~/.ansible/roles
cd ~/.ansible/roles
git clone https://github.com/alvistack/ansible-role-podman.git podman

Use pip3/pip to install all requirements including ansible.

cd podman
pip3 install --upgrade --ignore-installed --requirement requirements.txt

Add ~/.local/bin to your PATH env

### Bash ###
echo 'export PATH=$PATH:~/.local/bin' >>~/.bashrc
source ~/.bashrc
echo $PATH

### Zsh ###
echo 'export PATH=$PATH:~/.local/bin' >>~/.zshrc
source ~/.zshrc
echo $PATH

Now execute the sequence necessary to converge the instances

molecule converge

Sample execution output:

....
ASK [include role] ************************************************************

TASK [podman : include default variables] **************************************
ok: [localhost]

TASK [podman : include release specific variables] *****************************
ok: [localhost] => (item=/home/debian/.ansible/roles/podman/files/../vars/debian-11.yml)

TASK [podman : include release specific tasks] *********************************
included: /home/debian/.ansible/roles/podman/tasks/debian.yml for localhost => (item=/home/debian/.ansible/roles/podman/tasks/./debian.yml)

TASK [podman : apt-key add] ****************************************************
ok: [localhost] => (item={'keyring': '/etc/apt/trusted.gpg.d/home_alvistack.gpg', 'url': 'http://download.opensuse.org/repositories/home:/alvistack/Debian_11/Release.key', 'id': '789CFFDE0295B8A1F4E5690C4BECC97550D0B1FD', 'state': 'present'})

TASK [podman : apt-add-repository] *********************************************
ok: [localhost] => (item={'filename': 'home:alvistack', 'repo': 'deb http://download.opensuse.org/repositories/home:/alvistack/Debian_11/ /', 'state': 'present'})

TASK [podman : apt-get install] ************************************************
changed: [localhost] => (item={'state': 'latest', 'name': 'podman'})

TASK [podman : flush handlers] *************************************************

RUNNING HANDLER [podman : podman | systemctl restart podman.service] ***********
ok: [localhost -> localhost] => (item=localhost)

TASK [podman : systemctl start podman.service] *********************************
ok: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=45   changed=10   unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Once done finalize the installation by running the following command:

molecule verify

Execution output is as shared in screenshot below

install podman debian linux

Step 4: Confirm Podman installation on Debian

Check podman version

$ podman --version
podman version 4.6.1

$ podman version
Client:       Podman Engine
Version:      4.6.1
API Version:  4.6.1
Go Version:   go1.21.0
Built:        Thu Jan  1 00:00:00 1970
OS/Arch:      linux/amd64

You can display information pertaining to the host, current storage stats, and build of podman.

$ podman info
host:
  arch: amd64
  buildahVersion: 1.26.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: cgroupfs
  cgroupVersion: v2
  conmon:
    package: conmon_100:2.1.0-2_amd64
    path: /usr/libexec/podman/conmon
    version: 'conmon version 2.1.0, commit: '
  cpuUtilization:
    idlePercent: 99.33
    systemPercent: 0.23
    userPercent: 0.45
  cpus: 4
  distribution:
    codename: bullseye
    distribution: debian
    version: "11"
  eventLogger: file
  hostname: debian
....

Main configuration files:

  • /etc/containers/registries.conf ā€“ configuration file which specifies which container registries should be consulted when completing image names which do not include a registry or domain portion.
  • /etc/containers/mounts.conf ā€“ specify volume mount directories that are automatically mounted inside containers when executing theĀ podman runĀ orĀ podman buildĀ commands

Step 5: Test Podman installation on Debian

Ltā€™s start by pulling Alpine docker image.

$ podman pull alpine
Trying to pull docker.io/library/alpine...
Getting image source signatures
Copying blob 050382585609 done
Copying config b7b28af77f done
Writing manifest to image destination
Storing signatures
e66264b98777e12192600bf9b4d663655c98a090072e1bab49e233d7531d1294

Run docker container:

$ podman images
REPOSITORY                 TAG      IMAGE ID       CREATED       SIZE
docker.io/library/alpine  latest      e66264b98777  3 weeks ago  5.82 MB

$ podman run -ti docker.io/library/alpine /bin/sh
/ # cat /etc/os-release 
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.16.0
PRETTY_NAME="Alpine Linux v3.16"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/
/# exit

Now that we have confirmed we can create a container, letā€™s remove it.

$ podman rm -f `podman ps -aq`
777f6e4921dea595c900fc22cb3d0ee7d1009cc0a7e74fa1d2b9dfa7412c371d

There you go. Check more examples on Podman tutorial available in Github and our guide.

More guides on Podman:

Related guides:

RELATED ARTICLES

Most Popular

Recent Comments

ź°•ģ„œźµ¬ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
źøˆģ²œźµ¬ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ź“‘ėŖ…ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ź“‘ėŖ…ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė¶€ģ²œģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
źµ¬ģ›”ė™ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ź°•ģ„œźµ¬ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ģ˜¤ģ‚°ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ź“‘ėŖ…ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ģ•ˆģ–‘ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ė¶€ģ²œģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė™ķƒ„ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ģ„œģšøģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė¶„ė‹¹ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė¶€ģ²œģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ķ™”ź³”ė™ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ź°•ģ„œźµ¬ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ź³ ģ–‘ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ķ™”ģ„±ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ģ²œķ˜øė™ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?