Installing Podman
Installing Podman on Fedora, CentOS Stream, Rocky Linux
- Installs Podman
- configures the environment with config files (covered in the next section).
- installs
systemdunits to provide additional features such as REST API services or container auto-updates.
Installing Podman on RHEL
On RHEL 8, the Podman package is available as a single package and also under a dedicated module called container-tools
Installs, along with Podman and required libraries, other useful tools that will be covered later in this book:
- Skopeo, a tool for managing OCI images and registries
- Buildah, a specialized tool for building custom OCI images from Dockerfiles and from scratch
- CRIU, a utility to implement checkpoint/restore functionality for Linux
- Udica, a tool for generating SELinux security profiles for containers
If not interested in the full module content, users can install the Podman package only:
On RHEL9/10, there is no container-toolsmodule. Instead, users will be able to install a container-tools meta-package that brings the same extra tools as the module:
If not interested in full meta-package:
(Not) Installing Podman on Fedora CoreOS and Fedora Silverblue
Podman is already installed on both distributions and is a crucial tool for running containerized workloads.
The Fedora CoreOS and Fedora Silverblue distributions are immutable, atomic operating systems aimed to be used on server/cloud and desktop environments, respectively.
Fedora CoreOS https://getfedora.org/en/coreos is the upstream of Red Hat CoreOS, the operating system used to run Red Hat OpenShift and the base OS of OpenShift Kubernetes Distribution (OKD), the community-based Kubernetes distribution used as the upstream of Red Hat OpenShift.
Fedora Silverblue
- Desktop-focused immutable operating system that aims to provide a stable and comfortable desktop user experience, especially for working with containers.
Installing Podman on Debian and Raspberry Pi OS
Installing Podman on Ubuntu
Installing Podman on openSUSE
Installing Podman on Gentoo
The emerge utility will download and automatically build the Podman sources on the system.
Installing Podman on Arch Linux
By default, Podman's installation on Arch Linux does not permit rootless containers. To enable them, follow the official Arch wiki instructions: https://wiki.archlinux.org/title/Podman#Rootless_Podman
Installing Podman on macOS
Apple users develop and run Linux containers can install and use Podman as a remote client, while the containers are executed on a remote Linux box. The Linux machine can also be a VM that’s executed on macOS and directly managed by Podman.
The Podman project offers a macOS installer that can be downloaded from Podman.io
Alternatively, even though this is not recommended by the Podman developer team, users can install Podman using the Homebrew package manager by running the following command from the Terminal:
To initialize the VM running the Linux box, run the following commands:
In the preceding example, the Podman Machine service is initialized and started.The service downloads and configures a dedicated Linux virtual machine that runs the containers seamlessly. You can even initialize and start it with this command:
Alternatively, users can create and connect to an external Linux host by using Podman as a remote client.
Another valid approach on macOS to creating fast, lightweight VMs for development use is Vagrant. When the Vagrant machine is created, users can manually or automatically provision additional software, such as Podman, and start using the customized instance using the remote client.
Installing Podman on Windows
Running Podman on Windows Subsystem or Linux (also known as WSLv2) is a simple and convenient alternative to execute
containers on Windows. The guest distribution runs on a Podman machine that can be automatically created with the
podman machine init command. This solution requires a recent release of Windows 10 or Windows 11 to support WSLv2 and a system capable of supporting virtualization (used internally by WSLv2).
As an alternative, it’s even possible to use Hyper-V as documented on the Podman documentation page.
As a first step, download the latest release of the installer (named podman-x.y.z-setup.exe from the GitHub releases page
https://github.com/containers/podman/releases/ and launch the setup to complete the installation process.
When the setup is complete, open a terminal and launch the following command:
If WSLv2 is not already installed on the system, the command will also take care of it and produce a prompt to initialize the automated installation of the Podman machine, which includes the installation of the necessary WSLv2 components, reboot(s), and the import of the Podman machine. Obviously, users can choose to skip the automated installation of WSLv2 and choose to install it manually. If WSLv2 is already installed, the command will simply download a minimal Fedora distribution and import it into WSL.
When the import into WSLv2 is complete, start the Podman machine:
The system is now ready to run containers in the Podman machine executed in WSLv2.
Alternatively, to run Podman as a remote client only, we have a Podman command to manage the system connections:
podman system connection add, which automates the edit in Podman’s configuration. The manual, not recommended, way is to download and install the latest release from the GitHub releases page https://github.com/containers/podman/releases/, Extract the .zip archive in a suitable location and edit the TOML-encoded containers.conf file to configure a remote URI for the Linux machine or pass additional options.
The following code snippet shows an example configuration:
The remote Linux machine exposes Podman on a UNIX socket managed by a systemd
Building Podman from source
Building an application from source has many advantages: users can inspect and customize code before building, cross-compile for different architectures, or selectively build only a subset of binaries. It is also a great learning opportunity to get into the project’s structure and understand its evolution. Last but not least, building from source lets the users get the latest development versions with cool new features, bugs included.
The following steps assume that the building machine is a Fedora distribution.
Install the necessary build dependencies needed to compile Podman:
The dnf builddep command will install all the necessary build dependencies declared in the rpm/podman.spec file. It will take a while to install all the packages and their cascading dependencies.
Before starting the build, install the following runtime dependencies:
Remember that the RPM format is associated with Fedora/CentOS/RHEL distributions and managed by the dnf and yum package managers.
Change to the project directory and start the build:
The first make command compiles the source code, applying specific build tags that enable SELinux and seccomp support, even though in the latest release, the build process should auto-detect the build tags based on the installed libraries. The next sudo``make install command installs the packages locally under the /usr/bin path.
The build process will take a few minutes to complete. To test the successful installation of the packages, simply run the following command:
To create a binary release similar to the .tar.gz archive, which is available on the GitHub release page, run the following command:
Building a different version is very easy – just switch to the tag of the target release using the git command. For example, to build v5.3.0, use the following command: