This repository provides a Bash script to build and install a recent Podman release from source on Ubuntu 22.04 or 24.04, along with its networking stack (netavark + aardvark-dns) and supporting tools.
The script is designed for repeatable server setups where you want a newer Podman than the Ubuntu archive provides, but still want a lean runtime environment afterward.
- Builds Podman from source on Ubuntu 22.04 or 24.04 with configurable version (default:
v5.8.3). - Builds and installs:
conmon(container monitor)passt/pasta(for user-mode networking)netavark(container network stack)aardvark-dns(DNS server for container A/AAAA records)
- Step-level caching with
.statefiles so reruns resume from the last successful step instead of starting over. --dry-runmode to preview all actions without making changes.- Optional cleanup of build-time dependencies, toolchains, and workspace after a successful build.
- Flags to keep Go and/or Rust toolchains if you also use them for development on the host.
- Interactive or fully non-interactive modes for CI and automation.
- Ubuntu 22.04 (Jammy) or 24.04 (Noble) host.
sudoaccess for installing packages and placing binaries under/usrand/usr/local/libexec/podman.- Network access to fetch sources from GitHub and install toolchains.
The main script (for example install-podman-from-source.sh) performs these steps:
- Verifies the OS is Ubuntu 22.04 or 24.04.
- Installs build dependencies via
apt-get(compiler, headers, dev libraries, etc.). - Installs Go (configurable version) using a helper installer script.
- Clones and builds:
passtconmonpodmanat the requested tagnetavarkaardvark-dns
- Installs Podman under
/usr, and networking helpers under/usr/local/libexec/podman. - Installs
/etc/containers/registries.confand/etc/containers/policy.json. - Installs the Rust toolchain via
rustupand setsstableas the default toolchain (fornetavarkandaardvark-dnsbuilds). - Optionally cleans up build deps, toolchains, and the workspace.
Each major step writes a .done marker under ${WORKDIR}/.state only on success, so rerunning the script will skip completed steps unless you explicitly disable caching.
curl -fsSL https://bit.ly/podman-install | bashOr clone this repository and make the script executable:
git clone https://github.com/ffuad13/install-podman-from-source.git
cd install-podman-from-source
chmod +x ./install-podman-from-source.shRun interactively:
./install-podman-from-source.shThe script will show a plan and ask for confirmation before proceeding.
Run non-interactively:
./install-podman-from-source.sh -yPreview everything without making changes:
./install-podman-from-source.sh --dry-runPODMAN_VERSION=v5.9.0 \
GO_VERSION=1.22.4 \
WORKDIR="$HOME/src/podman-src" \
./install-podman-from-source.sh -yYou can use the built-in cleanup logic to remove build-time dependencies, toolchains, and the working directory once Podman is installed.
- Run a full build and then clean up:
./install-podman-from-source.sh -y --cleanup-after- Only run cleanup (no build steps):
./install-podman-from-source.sh --cleanup-onlyBy default, cleanup will remove:
- Build-time
aptpackages. - Go toolchain and caches (
/usr/local/go,~/.go,$GOPATH). - Rust toolchain and caches (
~/.rustup,~/.cargo). - Go / Rust environment entries in
~/.bashrcand~/.zshrc:export GOROOT=/home/ubuntu/.goexport PATH=$GOROOT/bin:$PATHexport GOPATH=/home/ubuntu/goexport PATH=$GOPATH/bin:$PATH. "$HOME/.cargo/env"
Use these flags to keep one or both toolchains and their shell configuration:
- Keep Go only:
./install-podman-from-source.sh --cleanup-only --keep-go- Keep Rust only:
./install-podman-from-source.sh --cleanup-only --keep-rust- Keep both Go and Rust:
./install-podman-from-source.sh --cleanup-only --keep-go --keep-rust- To resume after a failed step, just rerun:
./install-podman-from-source.sh -y- To force all steps to re-run but reuse cloned repos:
./install-podman-from-source.sh -y --no-cache- To completely reset the workspace before running:
./install-podman-from-source.sh -y --clean-workdirRun ./install-podman-from-source.sh --help to see the latest usage, but the key options are:
-
--dry-run, -n
Print what would be done, but do not execute. -
--yes, -y
Non-interactive; assume "yes" to prompts. -
--podman-version=VAL
Podman git tag to build (default:v5.8.3). -
--go-version=VAL
Go version for the helper installer (default:1.26.4). -
--no-cache, --force
Ignore cached step state and re-run all steps. -
--clean-workdir
Remove the entireWORKDIRbefore running. -
--cleanup-after
Run cleanup of build deps/toolchains after a successful build. -
--cleanup-only
Only run cleanup (no build or install steps). -
--keep-go
Keep Go toolchain and Go env config during cleanup. -
--keep-rust
Keep Rust toolchain and Rust env config during cleanup.
- This script specifically targets Ubuntu 22.04 or 24.04; use on other distributions or releases is not supported.
- It makes system-wide changes (
apt-get,/usr,/usr/local/libexec,/etc/containers), so you should review it before running in production. - Podman, netavark, and aardvark-dns are actively developed; you may need to adjust default versions or build flags over time.
This project is licensed under the MIT License. See the LICENSE file for details.