tags: - debian - apt - reprepro categories: - informational comments: true

date: 2022-01-23 00:00:00

DESCRIPTION

Host a postgresql APT repo locally Act as a middle man to control postgresql installs on clients

ERRORS

VERIFICATION

COMMANDS

Administrator computer

APT host node

mkdir /opt/site/pkg/postgresql
cd /opt/site/pkg/postgresql
ls
conf  index.html  root0.asc  root0.asc.sig

cd conf
ls
distributions  options  override.focal

client

Appendix A: root0-postgresql-apt-repo

#! /bin/bash
set -o pipefail
set -o errexit
set -o nounset
umask 0002

TMPDIR=$(mktemp -d)
DEBDIR=$(mktemp -d)
trap 'rm -rf ${TMPDIR} ${DEBDIR}' EXIT

APTREPO=${_APTREPO-mylxc1}
DIR=root0-postgresql-apt-repo

mkdir "${DIR}"
rsync -az --omit-dir-times --delete "${APTREPO}":/opt/site/pkg/postgresql/ "${DIR}/"

pushd "${DEBDIR}" >/dev/null
apt-get -qq download \
  pgdg-keyring \
  libpq5 \
  postgresql-common \
  postgresql-client-common \
  postgresql-client-14 \
  postgresql-14
popd >/dev/null

pushd "${DIR}" >/dev/null
for PGDEB in "${DEBDIR}"/*.deb ;do
  reprepro --ask-passphrase -Vb . \
    includedeb focal "${PGDEB}"
done
popd >/dev/null

rsync -avz --omit-dir-times --delete "${DIR}/" "${APTREPO}":/opt/site/pkg/postgresql/

Appendix B: Using nginx to host apt repo

apt install  --no-install-recommends nginx-core

References

https://wiki.debian.org/DebianRepository/SetupWithReprepro https://wiki.postgresql.org/wiki/Apt https://www.debian.org/doc/manuals/securing-debian-manual/deb-pack-sign.en.html