Last active
May 14, 2026 10:38
-
-
Save orimanabu/43197d72509d077a8739af5073bb0082 to your computer and use it in GitHub Desktop.
Install Podman on Amazon Linux 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # To build podman, you have enough resource on the instance. | |
| # I tested this script on t2.xlarge. | |
| topdir=${HOME}/work | |
| mkdir -p ${topdir} | |
| # Install prereq rpms | |
| sudo dnf install -y git golang libseccomp-devel gpgme-devel autoconf automake libtool yajl yajl-devel libcap-devel systemd-devel cni-plugins iptables-nft rpm-build meson golang-github-cpuguy83-md2man.x86_64 | |
| # Build podman | |
| echo "=> Building podman..." | |
| cd ${topdir} | |
| git clone https://github.com/containers/podman | |
| cd podman | |
| git switch v4.5 | |
| make | |
| sudo make install | |
| # Build conmon | |
| echo "=> Building conmon..." | |
| cd ${topdir} | |
| git clone https://github.com/containers/conmon | |
| cd conmon | |
| make -j | |
| sudo make install | |
| # Build crun | |
| echo "=> Building crun..." | |
| cd ${topdir} | |
| git clone https://github.com/containers/crun | |
| cd crun | |
| ./autogen.sh | |
| ./configure --prefix=/usr/local | |
| make -j | |
| sudo make install | |
| # Build libslirp | |
| echo "=> Building libslirp..." | |
| cd ${topdir} | |
| git clone https://gitlab.freedesktop.org/slirp/libslirp.git | |
| cd libslirp | |
| git switch stable-4.2 | |
| meson build | |
| ninja -C build | |
| sudo ninja -C build install | |
| # Build slirp4netns | |
| echo "=> Building slirp4netns..." | |
| cd ${topdir} | |
| git clone https://github.com/rootless-containers/slirp4netns.git | |
| cd slirp4netns | |
| git switch release/0.4 | |
| ./autogen.sh | |
| ./configure --prefix=/usr/local | |
| make -j | |
| sudo make install | |
| # Install containers-common | |
| echo "=> Building containers-common..." | |
| mkdir ${topdir}/Downloads | |
| cd ${topdir}/Downloads | |
| curl -LO https://ftp.jaist.ac.jp/pub/Linux/Fedora/updates/37/Everything/source/tree/Packages/c/containers-common-1-82.fc37.src.rpm | |
| rpm -ivh ${topdir}/Downloads/containers-common-1-82.fc37.src.rpm | |
| cd ${HOME}/rpmbuild | |
| rpmbuild -bb SPECS/containers-common.spec | |
| sudo dnf install -y RPMS/noarch/containers-common-1-82.amzn2023.noarch.rpm | |
| # Run podman | |
| echo "=> Running podman..." | |
| podman run --rm hello-world |
I used it to test from inside of AL2023 container:
FROM public.ecr.aws/amazonlinux/amazonlinux:2023
ARG PODMAN_VERSION=5.8.1
ARG SLIRP_VERSION=0.4
ARG LIBSLIRP_VERSION=stable-4.2
ENV BUILDDIR=/build
# Install base build dependencies
RUN dnf install -y \
git golang libseccomp-devel gpgme-devel autoconf automake libtool \
yajl yajl-devel libcap-devel systemd-devel cni-plugins iptables-nft \
rpm-build meson golang-github-cpuguy83-md2man ninja-build \
python3.12 python3.12-pip python3.12-devel python3-pip \
rust cargo protobuf-devel \
python3-sphinx e2fsprogs-devel uuid-devel libuuid-devel \
libblkid-devel libzstd-devel lzo-devel \
python3-sphinx_rtd_theme python-sphinx_rtd_theme-doc \
json-c-devel glib2-devel gcc gcc-c++ make pkgconfig \
&& dnf clean all
# Set up Python 3.12 as default and install pip packages
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 && \
pip3.12 install codespell sphinx sphinx_rtd_theme meson && \
sed -i '1s#/usr/bin/python3$#/usr/bin/python3.9#' /usr/bin/dnf && \
ln -sf /usr/local/bin/meson /usr/bin/meson
WORKDIR ${BUILDDIR}
RUN git clone https://github.com/containers/conmon && \
cd conmon && make -j && make install
RUN git clone https://github.com/containers/crun && \
cd crun && ./autogen.sh && ./configure --prefix=/usr/local && make -j && make install
RUN git clone https://gitlab.freedesktop.org/slirp/libslirp.git && \
cd libslirp && git checkout ${LIBSLIRP_VERSION} && \
meson build && ninja -C build && ninja -C build install
RUN git clone https://github.com/rootless-containers/slirp4netns.git && \
cd slirp4netns && git checkout release/${SLIRP_VERSION} && \
./autogen.sh && ./configure --prefix=/usr/local && make -j && make install
RUN git clone git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git && \
cd btrfs-progs && ./autogen.sh && ./configure --prefix=/usr/local && make -j && make install
RUN git clone https://github.com/containers/netavark.git && \
cd netavark && make -j && make install
RUN git clone git://passt.top/passt && \
cd passt && make -j && make install
# Build podman (last since it's the main target and changes most often)
RUN git clone https://github.com/containers/podman && \
cd podman && git checkout v${PODMAN_VERSION} && \
make && make install
# Set up container config files
RUN mkdir -p /etc/containers && \
cp ${BUILDDIR}/podman/test/registries.conf /etc/containers/registries.conf && \
echo ' "hello-world"="quay.io/podman/hello"' >> /etc/containers/registries.conf && \
cp ${BUILDDIR}/podman/test/policy.json /etc/containers/policy.json
# Update ldconfig so libslirp is found
RUN ldconfig
CMD ["podman", "--help"]
With some fixes it works.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've updated this a bit for April 2026 - supports Podman 5.8.1 and some other updates and config.
It's a bit of a mess, but handles some things better and fills a few gaps from a fresh AWS Linux 2023.20260406 AMI.
Use at your own risk.