Containers

How To Install Podman 4.x on CentOS 7 / RHEL 7

Podman is not in the CentOS 7 or RHEL 7 repositories, and both distributions went end of life in June 2024, so the package route is closed. The only way to run a current Podman on these hosts is to build it from source, and the build works if you fix four things the older guides skip. We rebuilt the chain on a clean CentOS 7 box and landed Podman 4.9.5, runc 1.1.12 and conmon 2.0.26, running rootless containers on the 3.10 kernel. The pieces that make that possible are:

Original content from computingforgeeks.com - post 120818
  • The SELinux container policy, which the EPEL containers-common package does not pull in on its own
  • User namespaces raised above zero, since EL7 ships the sysctl at 0 and rootless Podman cannot start without it
  • A gpgme.pc file, because the EL7 gpgme-devel package never shipped one and the Podman build fails without it
  • conmon 2.0.26, the release we validated against EL7’s older libseccomp and kernel headers

Together they keep cgroups v1 handling, SELinux labeling and multi-tenant isolation working the way upstream intends. There’s a ceiling, and we’ll say it up front: conmon stops at 2.0.26 on this base, so what you build here is the last Podman line this host can take. Every command below was run on a fresh CentOS 7 machine in November 2026.

Fix the Repositories First

Nothing installs until yum works again, because mirrorlist.centos.org no longer resolves and a fresh EL7 box answers yum repolist with zero packages. Our guide on fixing CentOS 7 repositories that no longer work explains the full picture, so we keep this section to the short version we ran on the lab box. Move your dead repo definitions aside, then generate vault-backed replacements with the two scripts our CentOS 7 repositories guide publishes. Grab both scripts into your current directory, then run:

mkdir -p ~/repos_backup
sudo mv /etc/yum.repos.d/* ~/repos_backup/
bash generate_base_repos.sh
printf 'n\nn\nn\ny\nn\ny\nn\ny\n' | bash enable_repos.sh
sudo cp -r centos7_repos/* /etc/yum.repos.d/
sudo yum clean all
sudo yum makecache fast

Each script writes one .repo file per repository, and the os.repo file points straight at the vault instead of the dead mirrorlist. Nothing here needs hand editing, and ours came out matching this:

[os]
name=CentOS-$releasever - os
baseurl=https://vault.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

The cache rebuild takes about a minute. With it done, the same yum repolist that failed earlier now reports 16,771 packages:

yum repolist on CentOS 7 failing because mirrorlist.centos.org no longer resolves

You’ll see the failed list first. After the fix, the same command answers with the vault-backed set:

yum repolist showing 16771 packages after pointing CentOS 7 at vault.centos.org

Once both numbers make sense on your box, the rest of the build can pull what it needs, because every dependency in this guide comes from the vault or from EPEL. Don’t move on until the repolist shows a five-digit count, since a half-built cache fails later with errors that look nothing like a repo problem. Keep the ~/repos_backup directory around too, because restoring those files is the fastest way to undo this if anything goes sideways.

Enable the EPEL Archive

EPEL matters for this build because it supplies containers-common, containernetworking-plugins and container-selinux. The old dl.fedoraproject.org URL for the EPEL 7 release package returns 404 now, so take the release RPM from the Fedora archives instead.

curl -sLO https://archives.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm
sudo yum -y install ./epel-release-7-14.noarch.rpm

Installation finishes cleanly. The EPEL metalink still resolves even though the distribution is archived, which the repolist below proves:

yum repolist showing EPEL 7 with 13791 packages from the Fedora archives

With EPEL enabled, the repo list carries 30,562 packages across both sources, so every dependency the builds need is reachable. EPEL is archived rather than dead, and that is why its metalink still resolves without the hand edits the base repos required. If a later step complains about a missing devel package, check that EPEL shows up in this list before you assume the build itself broke.

Install the Build Tools

One groupinstall brings gcc, make, git and autoconf in a single pass, and installing them one by one fails on a fresh box because yum list available only reports packages that are not already present. After the group, add the libraries every build in this guide links against:

sudo yum -y groupinstall "Development Tools"
sudo yum -y install device-mapper-devel btrfs-progs-devel conmon containernetworking-plugins containers-common glib2-devel glibc-devel glibc-static golang-github-cpuguy83-md2man gpgme-devel iptables libassuan-devel libgpg-error-devel libseccomp-devel libselinux-devel pkgconfig systemd-devel yajl-devel libcap-devel python3 python3-devel python3-pip wget

On the lab VM the group install took 1m17s, and the two yum runs together pulled containers-common, which drops its default configuration into place before Podman is ever built. On the lab box those files were:

  • /etc/containers/storage.conf
  • /etc/containers/registries.conf
  • /etc/containers/policy.json

Those defaults are old but usable, and one of them needs a small edit later in the install section. Confirm your toolchain before moving on:

gcc, make and Go versions ready on CentOS 7 before building Podman

gcc 4.8.5 and GNU Make 3.82 are old, but both conmon and runc compile with them, so there is no reason to replace them before you have a working build. The compiler only becomes a real problem when you reach Podman itself, and the Go install in the next section closes that gap. Don’t hunt for a newer gcc in the vault, because it does not exist there and building one from source costs more time than the whole Podman compile.

Install Go

EL7 ships no usable Go, and Podman 4.9 needs a newer toolchain than anything the distro offers, so pull the last 1.21 release from the official Go download page and unpack it over /usr/local/go:

curl -sLO https://go.dev/dl/go1.21.13.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.21.13.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
go version

You should see go version go1.21.13 linux/amd64 from the last command. Keep the PATH alive across sessions so the builds in the next sections find it:

echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> ~/.bashrc

With the compiler in place, the two small C builds come first, then the long one. Keep your shell open in the home directory, because every clone below lands there.

Build and Install conmon

Podman 4.9 shells container I/O through conmon and expects the --full-attach option, which the EPEL conmon 2.0.8 package predates by more than eight months. The current conmon 2.1.x line will not build here at all, as the lab confirmed on 2.1.4, 2.1.10 and 2.1.13: meson demands libseccomp 2.5.2 or newer, and even with a newer libseccomp compiled by hand, the 3.10 kernel headers do not declare the seccomp notify structs the code includes:

conmon 2.1.x build failing on CentOS 7 because libseccomp 2.3.1 is too old and kernel headers lack seccomp structs

Version 2.0.26 is the tag we pinned after the failures above, and it compiles cleanly with a plain make. The 2.1.x line and everything newer refuse to build on this base, so stay inside 2.0.x:

git clone https://github.com/containers/conmon
cd conmon
git checkout v2.0.26
make
sudo make install
conmon --version

Your make run finishes in a few seconds. The install step may complain that it cannot build the man page without go-md2man, and that complaint is harmless, because the binary itself lands in /usr/local/bin/conmon either way. The version command should answer conmon version 2.0.26.

Build and Install runc

Next comes the OCI runtime. The 1.1 maintenance line ran through v1.1.15, and runc 1.1.12 is the release we validated: it builds against EL7’s libseccomp without any patching, and the compile took about 30 seconds on the lab VM. You can point the checkout at the newest 1.1.x tag instead, because the build commands are identical:

git clone https://github.com/opencontainers/runc
cd runc
git checkout v1.1.12
make BUILDTAGS="selinux seccomp"
sudo cp runc /usr/local/bin/runc
sudo cp runc /usr/bin/runc
runc --version

Its version output confirms the build tags took effect, reporting runc 1.1.12 with seccomp support linked in. Both copies matter, because the rootless user’s PATH and root’s sudo secure_path differ, and a missing copy shows up later as a runtime error in only one of the two modes.

Build Podman

Download the source tarball from the Podman releases page, then start the build. It’s the long step, about two and a half minutes on two cores:

cd ~
wget -q https://github.com/containers/podman/archive/refs/tags/v4.9.5.tar.gz -O v4.9.5.tar.gz
tar xf v4.9.5.tar.gz
cd podman-4.9.5
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
export GOPATH=$HOME/go
make BUILDTAGS="selinux seccomp"

On EL7 the first attempt dies partway through with a pkg-config failure, even though gpgme-devel is installed. Your error will name the missing package, and ours named gpgme:

No package 'gpgme' found

Upgrading gpgme comes first, because EL7 ships 1.3.2 and the Go bindings in Podman 4.x call functions that only exist from GPGME 1.7.0 onward. The CentOS build service publishes newer gpgme packages for el7, so take both the runtime and the devel RPM from there:

mkdir -p /tmp/gpgme-rpms
cd /tmp/gpgme-rpms
curl -s -O https://cbs.centos.org/kojifiles/packages/gpgme/1.7.1/0.el7.centos.1/x86_64/gpgme-1.7.1-0.el7.centos.1.x86_64.rpm
curl -s -O https://cbs.centos.org/kojifiles/packages/gpgme/1.7.1/0.el7.centos.1/x86_64/gpgme-devel-1.7.1-0.el7.centos.1.x86_64.rpm
sudo rpm -Uvh gpgme-1.7.1-0.el7.centos.1.x86_64.rpm gpgme-devel-1.7.1-0.el7.centos.1.x86_64.rpm
rpm -q gpgme gpgme-devel

The upgrade ends with both packages reporting 1.7.1, and yum keeps working, because the RPMs come from CentOS’s own build service.

A packaging gap causes this, not a missing library. Even the 1.7.1 build ships only the legacy gpgme-config script and no gpgme.pc file, while modern Go builds discover their dependencies through pkg-config, so the build cannot see a library that is actually there. Write the missing file by hand, using the version your own gpgme-config --version reports:

pkg-config failing to find gpgme on CentOS 7, then reporting version 1.7.1 after the gpgme.pc file is written

Create the file with your editor at the path below. The location matters on a 64-bit host, so stay under /usr/lib64/pkgconfig and not /usr/lib/pkgconfig:

sudo vim /usr/lib64/pkgconfig/gpgme.pc

Add exactly this, with the version number matching your gpgme. Ours reported 1.7.1:

prefix=/usr
exec_prefix=/usr
libdir=/usr/lib64
includedir=/usr/include

Name: gpgme
Description: GnuPG Made Easy (GPGME), generated for el7 which ships no .pc file
Version: 1.7.1
Libs: -L${libdir} -lgpgme
Cflags: -I${includedir}

Verify that pkg-config can see the library now, then rerun the build from the top of the source tree. The build picks up from the failed target, so nothing is wasted:

pkg-config --modversion gpgme
cd ~/podman-4.9.5
make BUILDTAGS="selinux seccomp"

Expect roughly two more minutes on the retry, which ends with a working binary in bin/podman, ready to install. Anything other than a clean exit at this point points back at the .pc file you just wrote.

Install Podman

Installing under /usr puts the binary, systemd units and man pages in their normal EL7 paths. The install itself finishes in seconds:

sudo make install PREFIX=/usr

A first podman version still fails, twice over, before the host is configured, and both failures are expected on a stock EL7 box. Most guides from 2022 leave you stranded right here, so these are the two errors you’ll hit:

  • user namespaces disabled at the sysctl
  • a storage.conf key Podman 4.9 rejects

You’ll hit both messages in the same failed run, and the capture below shows the namespace half.

podman version failing with cannot clone: Invalid argument because user.max_user_namespaces is 0 on CentOS 7

The clone error is the louder of the two, and it is the one you fix first.

user namespaces are not enabled in /proc/sys/user/max_user_namespaces

Rootless Podman needs unprivileged user namespaces, and EL7 ships the sysctl at 0. Raise it, then make the setting survive reboots, because the change below is gone at the next boot otherwise:

sudo sysctl -w user.max_user_namespaces=15000

Persist it with a sysctl drop-in. A sysctl -w change alone dies at the next reboot:

sudo vim /etc/sysctl.d/99-userns.conf

One line goes in the file and nothing else. No other key in that file changes:

user.max_user_namespaces = 15000

That is the whole file. With it in place the namespace error never comes back, which the reboot check at the end of this guide confirms.

Failed to decode the keys [“storage.options.override_kernel_check”]

Your containers-common package writes a storage.conf that carries override_kernel_check = "true" under [storage.options], and Podman 4.9 rejects that key outright because the option was removed upstream. Open the file:

sudo vim /etc/containers/storage.conf

Its override_kernel_check key sits under [storage.options] around line 29. Comment it out and save:

# override_kernel_check = "true"

After both fixes, podman version answers on the first try for the rootless user and for root, because the binary was never the problem and the host configuration was. Most Podman failures you’ll meet on EL7 come from host policy and kernel settings, not from broken software. Keep that in mind when you troubleshoot, and check the sysctl and the config files before you suspect the build.

Remove the EPEL conmon

There is one more silent trap. Installing the build dependencies pulled EPEL’s conmon 2.0.8 into /usr/bin, and Podman finds that one first, so your fresh 2.0.26 sits unused in /usr/local/bin while every container fails to start.

conmon: option parsing failed: Unknown option –full-attach

You’ll get that exact error when Podman picks up the old EPEL binary. Confirm the two versions, then remove the RPM so the source build is the only conmon left:

rpm -q conmon
sudo rpm -e conmon
podman run --rm docker.io/library/alpine:latest echo hello

Nothing depends on the package, so the erase is safe. On the lab box the first run after the erase still refused to start, for a different reason covered next.

Run Your First Container

Containers exit with code 139

A rootless podman run that dies instantly with exit 139, and no error text, means the container process is segfaulting before it prints anything. You can prove SELinux is the cause in one run, by disabling labeling with --security-opt label=disable: when that run succeeds while the normal one fails, your host is missing the container policy. That’s exactly what the lab saw, and the capture below shows both sides of the test.

podman run exiting 139 before container-selinux is installed, then printing hello from an enforcing rootless container after the fix

Install the policy package below. It carries the SELinux module that knows how to label container processes and mounts, and it comes from the EPEL archive you enabled earlier.

sudo yum -y install container-selinux

Our lab installed 2.119.2 from the EPEL archive, and no reboot is needed, because the very next run under SELinux enforcing succeeded. If you want to dig deeper into how Podman and SELinux interact on RPM systems, our guide on configuring SELinux context for Podman storage covers the volume-labeling cases too. Run the hello test in both modes:

podman run --rm docker.io/library/alpine:latest echo hello-from-podman-on-centos7
sudo podman run --rm docker.io/library/alpine:latest echo hello-rootful-centos7

Both modes print their greeting on the lab box. The local image list fills up as the pulls complete:

rootless and rootful alpine containers printing hello on CentOS 7 with the podman images list below

Containers on this host report cgroupManager: cgroupfs and cgroup v1, because the 3.10 kernel only implements cgroup v1 and this build defaults to the cgroupfs manager. That’s not a defect you need to fix, since both modes run fine on the cgroupfs manager, but don’t be surprised when resource limits in podman info look different from a modern host. If you ever migrate these containers to a cgroup v2 system, the runtime handles the translation, so nothing in your images or scripts changes.

What Survives a Reboot

A build this long deserves a persistence check, so the lab VM was rebooted before signing off. The check covers four things, because a setup that loses its sysctl or its binaries on a restart is not one you can trust for real work:

  • image storage survives the reboot
  • the userns sysctl reapplies at boot
  • all three binaries keep their versions
  • a fresh pull and run works immediately

Here’s how the check looked on the lab box:

podman images surviving a CentOS 7 reboot with the userns sysctl still set to 15000

Version numbers held across the reboot, so nothing in this setup depends on state that a restart clears. Containers you left behind do not resume on their own, though, so anything long-running needs a systemd unit or a manual restart. Our guide on running Podman as a systemd service shows the unit file that keeps a container alive across reboots.

Where the Build Stops

Be clear with yourself about what this host can and can’t take. conmon is the hard ceiling, because the 2.1.x line requires libseccomp 2.5.2 and the seccomp notify API that appeared after the 3.10 kernel, and neither of those can be backported without rebuilding the kernel itself. Podman 4.9.5 is happy with conmon 2.0.26, which is why the stack below it freezes at these exact versions. Newer Podman major releases ship build requirements that assume a modern userland, and we wouldn’t expect them to hold on glibc 2.17, so the honest plan is to treat 4.9 as the end of the line for EL7.

None of that makes the build pointless. The vault still serves kernel and userland security updates, so keep yum update running, and rebuild Podman from source whenever a CVE lands, because the binary never updates itself. If you still carry the commands from our Podman 3.x guide on CentOS 7 / RHEL 7, drop them for this build, because the versions and the host fixes differ. For day-to-day usage on this host, our Podman cheat sheet covers the rootless, pod and quadlet commands the 4.x line supports. And if you can move the workload instead of the version, Podman ships in the repositories on every distribution that replaced these, from the Rocky Linux 10 / AlmaLinux 10 packages to the packaged install on CentOS 8 / RHEL 8, and those guides take minutes instead of an afternoon.

Keep reading

Best UI Applications for Managing Docker Containers Containers Best UI Applications for Managing Docker Containers Install Docker and Run Containers on Ubuntu 24.04|22.04 Containers Install Docker and Run Containers on Ubuntu 24.04|22.04 Install UniFi OS Server on Ubuntu 26.04 / 24.04 LTS Containers Install UniFi OS Server on Ubuntu 26.04 / 24.04 LTS Traefik 3.8 Upgrade: Breaking Changes, Yaegi v2 and Helm Test Containers Traefik 3.8 Upgrade: Breaking Changes, Yaegi v2 and Helm Test magpie: One AI Gateway for Claude Code and Codex on Linux AI magpie: One AI Gateway for Claude Code and Codex on Linux Aptakube Kubernetes GUI: Install and Multi-Cluster Setup Containers Aptakube Kubernetes GUI: Install and Multi-Cluster Setup

2 thoughts on “How To Install Podman 4.x on CentOS 7 / RHEL 7”

  1. Hello!
    Thank you for the useful guide, I followed your guide and ran pull command successfully but every time I run a container for ex like “podman run nginx” it always exited with code 139. I also followed your guide about install 3.x on centos7 and all work successfully and very well. Can you help me fix this issue?

    Reply
    • We have tested by re-producing this installation and it works fine. See output below:


      podman run nginx
      ✔ docker.io/library/nginx:latest
      Trying to pull docker.io/library/nginx:latest...
      Getting image source signatures
      Copying blob 7247f6e5c182 done
      Copying blob 7a6db449b51b done
      Copying blob ca1981974b58 done
      Copying blob d4019c921e20 done
      Copying blob 7cb804d746d4 done
      Copying blob e7a561826262 done
      Copying config 2b7d6430f7 done
      Writing manifest to image destination
      Storing signatures
      /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
      /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
      /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
      10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
      10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
      /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
      /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
      /docker-entrypoint.sh: Configuration complete; ready for start up
      2022/09/05 15:19:34 [notice] 1#1: using the "epoll" event method
      2022/09/05 15:19:34 [notice] 1#1: nginx/1.23.1
      2022/09/05 15:19:34 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
      2022/09/05 15:19:34 [notice] 1#1: OS: Linux 3.10.0-1160.76.1.el7.x86_64
      2022/09/05 15:19:34 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
      2022/09/05 15:19:34 [notice] 1#1: start worker processes
      2022/09/05 15:19:34 [notice] 1#1: start worker process 30

      Reply

Leave a Comment

Press ESC to close