Build local repositories for RPM, APT, and pacman so you can distribute internal packages without relying on external mirrors. Generate the correct metadata artifacts so clients can query and install packages the same way they do from public repos.
You need to host and maintain local package repositories for custom software. Your task is to stage packages into the correct repo locations and generate the metadata that RPM-based, Debian-based, and Arch-based clients expect.
Local repositories are common in locked-down environments, air-gapped networks, and internal release pipelines. The work is mostly “put packages in the right place” plus “generate the index files correctly,” then validate client behavior.
.rpm packages.
createrepo.
.deb packages.
dpkg-scanpackages and compress it to
Packages.gz.
repo-add.
/var/www/html/repo) for repo access.
createrepo.
dpkg-scanpackages and gzip compression.
repo-add for *.pkg.tar.zst packages.
mkdir -p /var/www/html/repo && cp *.rpm /var/www/html/repo
This stages all RPMs into a single directory that can be served via HTTP. The repo tooling expects package files to be present before metadata is generated.
Repository directory created and RPM files copied.
createrepo /var/www/html/repo
This creates the repodata/ directory and the
metadata files that yum/dnf clients read when they query the
repository.
Spawning worker 0 with 1 pkgs
Workers finished
Saving Primary metadata
Repo created successfully.
mkdir -p /srv/aptrepo && cp *.deb /srv/aptrepo
This stages Debian packages into a directory you can serve locally (HTTP/file share). The next step generates the package index clients use.
APT repository folder populated.
dpkg-scanpackages /srv/aptrepo /dev/null | gzip -9 > /srv/aptrepo/Packages.gz
This builds a minimal Packages index and writes a
compressed Packages.gz, which is a common format
for small local repos.
Package list generated and compressed for apt indexing.
repo-add myrepo.db.tar.gz *.pkg.tar.zst
This creates or updates the pacman repository database and indexes all packages in the current directory, enabling clients to install them as a standard repo.
:: Creating 'myrepo.db.tar.gz' database...
:: Adding package 'custompkg-1.0-1-x86_64.pkg.tar.zst'
Repo index updated.
mkdir -p <dir> && cp *.rpm <dir>
: Stage RPMs into a repository directory.
createrepo <repo_dir>
: Generate RPM repository metadata under
<repo_dir>/repodata/.
mkdir -p /srv/aptrepo && cp *.deb /srv/aptrepo
: Stage Debian packages into a repo directory.
dpkg-scanpackages <dir> /dev/null
: Scan a directory of .deb files and produce a
Packages index.
gzip -9 > Packages.gz
: Compress the Packages index for distribution.
repo-add <repo.db.tar.gz> *.pkg.tar.zst
: Create/update a pacman repository database with packages.