reprepro¶
reprepro is used as a local repository for deb packages.
Some apps, like SOPS, release deb files, but are not a part of the normal repository. Hosting them locally, allows me to download the package once and then easily update on all other containers.
Raspberry Pi Support¶
The raspi repository is used to support ARMv6 devices, such as the Raspberry Pi 1 and Raspberry Pi Zero W.
Installation¶
Config¶
Apache¶
/etc/apache2/apache2.conf
/etc/apache2/conf-availabe/repos.conf
Config¶
Repository¶
Make directories
shell
(
[ -d /srv/reprepro/debian/conf ] || mkdir -p /srv/reprepro/debian/conf
[ -d /srv/reprepro/ubuntu/conf ] || mkdir -p /srv/reprepro/ubuntu/conf
)
Generate new gpg keys
gpg --list-keys
pub 2048R/489CD644 2014-07-15
uid Your Name <[email protected]>
sub 2048R/870B8E2D 2014-07-15
Get short fingerprint
gpg -k [email protected] | sed -n '2p'| sed 's/ //g' | tail -c 9
Export public gpg key
/srv/reprepo/<dist>/conf/distributions
(
ln -s /root/git/nicholaswilde/homelab/pve/reprepro/debian/conf/distributions /srv/reprepro/debian/conf/distributions
ln -s /root/git/nicholaswilde/homelab/pve/reprepro/ubuntu/conf/distributions /srv/reprepro/ubuntu/conf/distributions
ln -s /root/git/nicholaswilde/homelab/pve/reprepro/raspi/conf/distributions /srv/reprepro/raspi/conf/distributions
)
(
curl -Lo /srv/reprepro/debian/conf/distributions https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/debian/conf/distributions
curl -Lo /srv/reprepro/ubuntu/conf/distributions https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/ubuntu/conf/distributions
curl -Lo /srv/reprepro/raspi/conf/distributions https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/raspi/conf/distributions
)
/srv/reprepo/<dist>/conf/options
(
curl -Lo /srv/reprepro/debian/conf/options https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/debian/conf/options
curl -Lo /srv/reprepro/ubuntu/conf/options https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/ubuntu/conf/options
curl -Lo /srv/reprepro/raspi/conf/options https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/raspi/conf/options
)
(
ln -s /root/git/nicholaswilde/homelab/pve/reprepro/debian/conf/options /srv/reprepro/debian/conf/options
ln -s /root/git/nicholaswilde/homelab/pve/reprepro/ubuntu/conf/options /srv/reprepro/ubuntu/conf/options
ln -s /root/git/nicholaswilde/homelab/pve/reprepro/raspi/conf/options /srv/reprepro/raspi/conf/options
)
/srv/reprepo/<dist>/conf/override.<codename>
(
sudo curl -Lo /srv/reprepro/debian/conf/override.bullseye https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/debian/conf/override.bullseye
sudo curl -Lo /srv/reprepro/debian/conf/override.bookworm https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/debian/conf/override.bookworm
sudo curl -Lo /srv/reprepro/debian/conf/override.trixie https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/debian/conf/override.trixie
sudo curl -Lo /srv/reprepro/debian/conf/override.raspi https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/debian/conf/override.raspi
sudo curl -Lo /srv/reprepro/ubuntu/conf/override.questing https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/ubuntu/conf/override.questing
sudo curl -Lo /srv/reprepro/ubuntu/conf/override.plucky https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/ubuntu/conf/override.plucky
sudo curl -Lo /srv/reprepro/ubuntu/conf/override.oracular https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/ubuntu/conf/override.oracular
sudo curl -Lo /srv/reprepro/ubuntu/conf/override.noble https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/ubuntu/conf/override.noble
sudo curl -Lo /srv/reprepro/ubuntu/conf/override.jammy https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/ubuntu/conf/override.jammy
sudo curl -Lo /srv/reprepro/raspi/conf/override.bookworm https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepr/raspi/conf/override.bookworm
sudo curl -Lo /srv/reprepro/raspi/conf/override.trixie https://github.com/nicholaswilde/homelab/raw/refs/heads/main/pve/reprepro/raspi/conf/override.trixie
)
(
sudo ln -fs /root/git/nicholaswilde/homelab/pve/reprepro/debian/conf/override.bullseye /srv/reprepro/debian/conf/override.bullseye
sudo ln -fs /root/git/nicholaswilde/homelab/pve/reprepro/debian/conf/override.bookworm /srv/reprepro/debian/conf/override.bookworm
sudo ln -fs /root/git/nicholaswilde/homelab/pve/reprepro/debian/conf/override.trixie /srv/reprepro/debian/conf/override.trixie
sudo ln -fs /root/git/nicholaswilde/homelab/pve/reprepro/debian/conf/override.raspi /srv/reprepro/debian/conf/override.raspi
sudo ln -fs /root/git/nicholaswilde/homelab/pve/reprepro/ubuntu/conf/override.questing /srv/reprepro/ubuntu/conf/override.questing
sudo ln -fs /root/git/nicholaswilde/homelab/pve/reprepro/ubuntu/conf/override.plucky /srv/reprepro/ubuntu/conf/override.plucky
sudo ln -fs /root/git/nicholaswilde/homelab/pve/reprepro/ubuntu/conf/override.oracular /srv/reprepro/ubuntu/conf/override.oracular
sudo ln -fs /root/git/nicholaswilde/homelab/pve/reprepro/ubuntu/conf/override.noble /srv/reprepro/ubuntu/conf/override.noble
sudo ln -fs /root/git/nicholaswilde/homelab/pve/reprepro/ubuntu/conf/override.jammy /srv/reprepro/ubuntu/conf/override.jammy
sudo ln -fs /root/git/nicholaswilde/homelab/pve/reprepro/raspi/conf/override.bookworm /srv/reprepro/raspi/conf/override.bookworm
sudo ln -fs /root/git/nicholaswilde/homelab/pve/reprepro/raspi/conf/override.trixie /srv/reprepro/raspi/conf/override.trixie
)
(
sudo touch /srv/reprepro/debian/conf/override.bookworm
sudo touch /srv/reprepro/debian/conf/override.bullseye
sudo touch /srv/reprepro/debian/conf/override.trixie
sudo touch /srv/reprepro/debian/conf/override.raspi
sudo touch /srv/reprepro/ubuntu/conf/override.questing
sudo touch /srv/reprepro/ubuntu/conf/override.plucky
sudo touch /srv/reprepro/ubuntu/conf/override.oracular
sudo touch /srv/reprepro/ubuntu/conf/override.noble
sudo touch /srv/reprepro/ubuntu/conf/override.jammy
sudo touch /srv/reprepro/raspi/conf/override.bookworm
sudo touch /srv/reprepro/raspi/conf/override.trixie
)
Environmental File¶
A .env file is used to set variables that are used with task and scripts.
Edit the .env file with your preferred text editor.
Adding a New Release Codename¶
To add a new release codename to reprepro:
- Add a new
override.<codename>file in/srv/reprepro/<dist>/conf. - Add a new entry to
/srv/reprepro/<dist>/conf/distributionsfile.
/srv/reprepro/<dist>/conf/distributions
Usage¶
Server¶
Add deb file to reprepro.
(
sudo reprepro -b /srv/reprepro/debian -C main includedeb trixie sops_3.9.4_amd64.deb
sudo reprepro -b /srv/reprepro/debian -C main includedeb bullseye sops_3.9.4_amd64.deb
sudo reprepro -b /srv/reprepro/debian -C main includedeb trixie sops_3.9.4_amd64.deb
sudo reprepro -b /srv/reprepro/raspi -C main includedeb trixie sops_3.9.4_armhf.deb
sudo reprepro -b /srv/reprepro/ubuntu -C main includedeb questing sops_3.9.4_amd64.deb
sudo reprepro -b /srv/reprepro/ubuntu -C main includedeb plucky sops_3.9.4_amd64.deb
sudo reprepro -b /srv/reprepro/ubuntu -C main includedeb oracular sops_3.9.4_amd64.deb
sudo reprepro -b /srv/reprepro/ubuntu -C main includedeb noble sops_3.9.4_amd64.deb
sudo reprepro -b /srv/reprepro/ubuntu -C main includedeb jammy sops_3.9.4_amd64.deb
)
Client¶
Download gpg key
Add repo and install.
/etc/apt/sources.list.d/reprepro.sources
Copy all package from one codename to another from noble to questing.¶
List all package information¶
Regenerate the Repository Index¶
This can fix BADSIG errors shown on remote hosts.
The badsig error means the Release.gpg file for that codename does not contain a valid signature for the Release
file. The Release file itself contains a list of all other index files (like Packages.gz) and their checksums.
Scripts¶
Some scripts are provided to help with common tasks.
Update Reprepro¶
The script update-reprepro.sh is used to compare the latest released versions of the apps specified with the
SYNC_APPS_GITHUB_REPOS and PACKAGE_APPS variables in the .env file to the local versions.
If out of date, the compressed archives specified in the PACKAGE_APPS variable are downloaded, packaged into deb files,
and added to reprepro and deb files located in the SYNC_APPS_GITHUB_REPOS variable are downloaded and add to reprepro.
Automation
The update-reprepro-service.sh script can be triggered automatically using a webhook. This is useful for continuous integration, for example, triggering an update after a new package has been built and pushed.
Package Neovim¶
The script package-neovim.sh is used to compare the latest released version of Neovim to the local version in reprepro.
If out of date, the compressed archive is downloaded, built, packaged into a deb file.
The reason this is separate from update-reprepro.sh is because dependencies need to get packaged along with the binary
and an armhf version is not part of the release package.
There are three ways to build the Neovim package for different architectures:
- Docker: Use
@pve/reprepro/docker/**on the localhost to build for multiple platforms. - Ansible: Use
@pve/reprepro/ansible/**if you have physical machines with different architectures. - Manual Script: Log into each machine with a different architecture and run the
@pve/reprepro/package-neovim.shscript.
Tip
To get multiple architectures of the deb file, the script may be run on different architecture platforms. For
instance, I use my RPi2 to build the armv7l, RPi5 to build
the arm64, and HP to build the amd64 version.
Package SOPS¶
The script package-sops.sh is used to compare the latest released version of SOPS to the local version in reprepro.
If out of date, the compressed archive is downloaded, built, packaged into a deb file.
The reason this is separate from update-reprepro.sh is because the sops repo doesn't offer an armhf version and so I
manually build and package the armhf version and add it to reprepro.
Tip
To get multiple architectures of the deb file, the script may be run on different architecture platforms. For
instance, I use my RPi2 to build the armhf version.
Upload Deb Files¶
Once the neovim or sops deb files are built, they are copied to the current pve/reprepro folder. The upload-debs task can then be used to push the deb files to the reprepro LXC using scp.
The REMOTE_IP, REMOTE_USER, and REMOTE_PATH variables in the .env file are used to specify the reprepro LXC.
Script Notifications¶
Some scripts can send notifications via Mailrise.
Set the MAILRISE_* variables and the ENABLE_NOTIFICATIONS variable in the .env file.
Cronjob¶
A cronjob can be setup to run every night to check the released versions.
2 A.M. nightly
Copy from one dist to another¶
reprepro -b /srv/reprepro/raspi/ includedeb trixie /srv/reprepro/debian/pool/main/l/localsend-cli/localsend-cli_1.2.2_armhf.deb
Remove app¶
reprepro -b /srv/reprepro/raspi listfilter bookworm "Package (== sops), Version (== 1.0.2)"
reprepro -b /srv/reprepro/raspi removefilter bookworm "Package (== sops), Version (== 1.0.2)"
Traefik¶
Task List¶
References¶
- https://santi-bassett.blogspot.com/2014/07/setting-up-apt-repository-with-reprepro.html?m=1
- https://wiki.debian.org/DebianRepository/SetupWithReprepro
- https://wikitech.wikimedia.org/wiki/Reprepro