Installing the latest Podman on Ubuntu 24.04

Estimated reading time: 3 minutes

Gerard Samuel Gerard Samuel's profile photo
Podman Logo taken from wikipedia.org

Podman is an open-source tool for managing and running containers and pods. It is similar to Docker but better. 😎

Here are a few differences between using Podman and using Docker. It is daemon-less, does not need root privileges, and can use systemd to run containers/pods. Unfortunately, under Ubuntu, the shipping version of Podman is old compared to the latest releases.

Here is what I did to install Podman from source on Ubuntu 24.04 LTS…

  • Update APT sources
sudo apt update
  • Install pre-requisite software
sudo apt install --yes \
  autoconf \
  automake \
  build-essential \
  btrfs-progs \
  gcc \
  git \
  go-md2man \
  iptables \
  libassuan-dev \
  libbtrfs-dev \
  libc6-dev \
  libcap-dev \
  libdevmapper-dev \
  libglib2.0-dev \
  libgpgme-dev \
  libgpg-error-dev \
  libprotobuf-dev \
  libprotobuf-c-dev \
  libtool \
  libseccomp-dev \
  libselinux1-dev \
  libsystemd-dev \
  libyajl-dev \
  linux-libc-dev \
  make \
  pkg-config \
  protobuf-compiler \
  uidmap
  • Change to the root user
sudo -i
  • Create a temp directory
TMPDIR=$(mktemp -d)
cd $TMPDIR
  • Create a few variables to determine software versions
GO_VERSION="1.23.2"
CRUN_VERSION="1.18"
CONMON_VERSION="2.1.12"
NETAVARK_VERSION="1.12.2"
PODMAN_VERSION="5.2.5"

I will install a few supporting software requirements from source before getting to Podman.

  • Build and install golang-go
curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
  -o "${TMPDIR}/go${GO_VERSION}.linux-amd64.tar.gz"
rm -rf /usr/local/go
tar -C /usr/local -xzf "$TMPDIR/go${GO_VERSION}.linux-amd64.tar.gz"
export PATH=$PATH:/usr/local/go/bin
go version
rm -rf .* * 2> /dev/null
  • Build and install crun
git clone --branch ${CRUN_VERSION} https://github.com/containers/crun.git $TMPDIR/
./autogen.sh
./configure
make install
crun --version
rm -rf .* * 2> /dev/null
  • Build and install conmon
git clone --branch "v${CONMON_VERSION}" https://github.com/containers/conmon.git $TMPDIR/
make
make install
make podman
conmon --version
rm -rf .* * 2> /dev/null
  • Install netavark
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
git clone --branch "v${NETAVARK_VERSION}" \
  https://github.com/containers/netavark.git $TMPDIR
make
make install
rustup self uninstall -y
rm -rf .* * 2> /dev/null
  • Get a few default configuration files from GitHub
mkdir -p /etc/containers  
curl -L -o /etc/containers/registries.conf https://raw.githubusercontent.com/containers/image/main/registries.conf  
curl -L -o /etc/containers/policy.json https://raw.githubusercontent.com/containers/image/main/default-policy.json
  • Now it is time to build and install Podman from source
git clone --branch "v${PODMAN_VERSION}" https://github.com/containers/podman.git $TMPDIR/
cd $TMPDIR
make BUILDTAGS="seccomp systemd" PREFIX=/usr
make install PREFIX=/usr
rm -rf .* * 2> /dev/null
  • Now, let me clean up the temp directory and go back to the home directory
cd ~
rmdir $TMPDIR
  • Enable the Podman socket
systemctl enable --now podman.socket
  • Review Podman’s configuration
podman info
  • Run a test image. The output should be similar to this:
podman run --rm quay.io/podman/hello
## Output below
Trying to pull quay.io/podman/hello:latest...
Getting image source signatures
Copying blob 81df7ff16254 done   | 
Copying config 5dd467fce5 done   | 
Writing manifest to image destination
!... Hello Podman World ...!

         .--"--.           
       / -     - \         
      / (O)   (O) \        
   ~~~| -=(,Y,)=- |         
    .---. /`  \   |~~      
 ~/  o  o \~~~~.----. ~~   
  | =(X)= |~  / (O (O) \   
   ~~~~~~~  ~| =(Y_)=-  |   
  ~~~~    ~~~|   U      |~~ 

Project:   https://github.com/containers/podman
Website:   https://podman.io
Desktop:   https://podman-desktop.io
Documents: https://docs.podman.io
YouTube:   https://youtube.com/@Podman
X/Twitter: @Podman_io
Mastodon:  @[email protected]
  • Remove the test image from local storage
podman image rm quay.io/podman/hello

Conclusion

Even though Ubuntu’s version of Podman from APT is “outdated”, you can still install the most current version on the latest long-term supported Ubuntu server.

Thanks!