FedoraRHEL Based

How To Install Podman on Fedora 38

Install Podman Fedora 38

In this tutorial, we will show you how to install Podman on Fedora 38. For those of you who didn’t know, Podman is a container management tool that allows users to run, manage, and interact with containers without requiring a daemon running in the background. It is compatible with Docker and OCI (Open Container Initiative) standards, making it a versatile choice for managing containers on Fedora 38.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Podman containers on a Fedora 38.

Prerequisites

  • A server running one of the following operating systems: Fedora 38.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Podman.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Podman on Fedora 38

Step 1. Before we can install Podman on Fedora 38, it’s important to ensure that our system is up-to-date with the latest packages. This will ensure that we have access to the latest features and bug fixes and that we can install Podman without any issues:

sudo dnf update

Step 2. Installing Podman on Fedora 38.

Now that we have prepared the system, we can proceed with the installation of Git on Fedora 38. There are two common methods for installation: using the package manager and building from the source.

  • A. Method 1: Using the DNF Package Manager

 Once your system is up to date, you can install Podman by running the following command:

sudo dnf install podman

After the installation is complete, you can verify that Podman is installed correctly by running the following command:

podman version

This command will display the version of Podman that is installed on your system.

  • B. Method 2: Building Podman from Source

Ensure you have the necessary development tools and libraries to build Podman:

sudo dnf install make gcc git golang glibc-devel btrfs-progs-devel device-mapper-devel ostree-devel

Create a directory for the Podman source code:

mkdir -p ~/podman-source && cd ~/podman-source

Clone the Podman repository from GitHub:

git clone https://github.com/containers/podman.git

Move into the Podman source directory:

cd podman

Compile Podman from the source:

make BUILDTAGS="selinux seccomp"

Once the compilation is complete, install Podman:

sudo make install

Step 3. Configuring Podman on Fedora 38.

After successful installation, it’s time to configure Podman and set it up for smooth container management.

  • A. Initializing Podman

Start Podman and initialize the required storage and network components:

sudo podman system service --time=0
  • B. Verifying Installation

To ensure Podman is correctly installed and running, check the version:

podman --version
  • C. Configuring Podman Rootless Containers

By default, Podman runs containers with rootless containers enabled, providing an added layer of security. However, to ensure rootless containers work seamlessly, you must enable user namespaces on your system. To do so, follow these steps:

sudo touch /etc/subuid /etc/subgid

Add your user to the /etc/subuid and /etc/subgid files. Replace username with your actual username:

sudo echo "username:100000:65536" >> /etc/subuid
sudo echo "username:100000:65536" >> /etc/subgid

Update the user namespace configuration:

echo "user.max_user_namespaces=28633" | sudo tee -a /etc/sysctl.conf
sudo sysctl --system
  • D. Managing Container Storage

Podman stores container images, volumes, and related data in the /var/lib/containers directory by default. To change the storage location, follow these steps:

sudo mkdir -p /path/to/new/container/storage

Edit the Podman configuration file:

sudo nano /etc/containers/storage.conf

Update the graphroot option with the new storage path:

[storage]
driver = "overlay"
runroot = "/run/containers/storage"
graphroot = "/path/to/new/container/storage"
Save and exit, then restart the Podman service for changes to take effect:
sudo systemctl restart podman

Step 4. Basic Podman Commands.

Now that Podman is installed and configured, let’s explore some essential commands for working with containers.

A. Running a Container

To start a container, use the following command:

podman run -d -p 8080:80 --name my_app nginx:latest

Explanation:

  • -d: Detach the container and run it in the background.
  • -p 8080:80: Map port 8080 on the host to port 80 in the container.
  • --name my_app: Assign the name “my_app” to the running container.
  • nginx:latest: The name of the image and tag to use.

B. Stopping and Removing Containers

To stop a running container, use the stop command:

podman stop my_app

To remove a stopped container, use the rm command:

podman rm my_app

C. Listing Containers

To view the list of running containers, use the ps command:

podman ps

To see all containers (including stopped ones), add the -a option:

podman ps -a

Step 5. Troubleshooting Podman on Fedora 38.

Despite its robustness, you may encounter issues while working with Podman. Here are some common troubleshooting tips:

  • A. Common Installation and Configuration Issues
  1. Verify that Podman is installed correctly by checking the version.
  2. Ensure you have root access or administrative privileges before installing Podman.
  3. Check for any typos or errors in the configuration files.
  4. Confirm that the required dependencies are installed for building Podman from the source.
  • B. Debugging Containers

If a container is not behaving as expected, follow these steps to investigate:

  1. Inspect the container’s logs
podman logs my_app
  1. Access the container’s shell for further investigation:
podman exec -it my_app /bin/bash
  • C. Investigating Systemd Services

If Podman is managed by systemd, you can check its status and logs:

sudo systemctl status podman
sudo journalctl -u podman

Congratulations! You have successfully installed Podman. Thanks for using this tutorial for installing Podman containers on your Fedora 38 system. For additional help or useful information, we recommend you check the official Podman website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button