Configure clients

See FreeBSD Handbook chapter Configuring pkg Clients to Use a Poudriere Repository.

Configure repos

Log to the clients. For example,

shell> uname -a
FreeBSD test 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64

and configure the repository. Copy the certificate build.example.com-sk.crt you created in Generate signing key

/usr/local/etc/pkg/repos/build.conf
build: {
  url: "http://build.example.com/packages/141Ramd64-default-devel",
  mirror_type: "none",
  enabled: yes,
  signature_type: "pubkey",
  pubkey: "/usr/local/etc/ssl/crt/build.example.com-sk.crt"
}

Disable the official repository

/usr/local/etc/pkg/repos/freebsd.conf
FreeBSD: {
    enabled: no
}

Display the configuration and repo details

shell> pkg -vv
...
Repositories:
  build: {
    url             : "http://build.example.com/packages/141Ramd64-default-devel",
    enabled         : yes,
    priority        : 0,
    signature_type  : "PUBKEY",
    pubkey          : "/usr/local/etc/ssl/crt/build.example.com-sk.crt"
  }

Configure local repo

In the localhost use url file:// instead of http://

/usr/local/etc/pkg/repos/build.conf
build: {
  url: "file:///usr/local/poudriere/data/packages/141Ramd64-default-devel/",
  mirror_type: "none",
  enabled: yes,
  signature_type: "pubkey",
  pubkey: "/usr/local/etc/ssl/crt/build.example.com-sk.crt"
}

Configure repos by Ansible

Look at the Ansible role vbotka.freebsd_packages.

Create the configuration data on the controller

host_vars/test.example.com/packages.yml
pkg_repos_conf:
  - name: build
    conf:
      - {key: 'url', value: '"http://build.example.com/packages/141Ramd64-default-devel"'}
      - {key: 'mirror_type', value: '"nomirror"'}
      - {key: 'enabled', value: 'yes'}
      - {key: 'signature_type', value: '"pubkey"'}
      - {key: 'pubkey', value: '"/usr/local/etc/ssl/crt/build.example.com-sk.crt"'}
  - name: FreeBSD
    conf:
      - { key: enabled, value: "no" }

and run ansible-playbook to configure the repos on the remote host test.example.com

shell> ansible-playbook freebsd-packages.yml -t pkg_conf
TASK [vbotka.freebsd_packages : Conf: Create directories] *******************
ok: [test.example.com] => (item=/usr/local/etc/pkg)
ok: [test.example.com] => (item=/usr/local/etc/pkg/repos)

TASK [vbotka.freebsd_packages : Conf: Configure /usr/local/etc/pkg/repos] ***
ok: [test.example.com] => (item=build)
ok: [test.example.com] => (item=FreeBSD)

Install packages

See the FreeBSD Handbook Chapter Installing and Fetching Packages.

Update the pkg database

shell> pkg update
Updating build repository catalogue...
Fetching meta.conf: 100%    178 B   0.2kB/s    00:01
Fetching data.pkg: 100%  140 KiB 143.8kB/s    00:01
Processing entries: 100%
build repository update completed. 500 packages processed.
All repositories are up to date.

Display packages info. For example,

shell> pkg info | grep pkg
pkg-1.21.3                    Package manager

Upgrade the package

shell> pkg upgrade pkg
Updating build repository catalogue...
build repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
Your packages are up to date.

See also