Operations grimoire/FreeBSD

From Nasqueron Agora

FreeBSD is the most deployed OS on Nasqueron servers.

General tips

  • Directories adheres to UNIX hierarchy:
    • Applications use /usr/local/etc for configuration
    • More generally, if an application on Linux uses /usr/..., on FreeBSD it will generally be /usr/local/...
  • BSD userland is different than Linux userland, but GNU coreutils is available, with g as prefix. For example, you can use gsed -i for inline sed replacement
  • Use GNU Makefile (gmake) if something is wrong with make

You can ask Dereckson for any question about FreeBSD.

Ports

Some packages need to be built through ports.

On some roles, this process is automated by Salt:

In other cases, for example when there is a conflict of versions, it's handled manually.

For example, as of 2023-05-30, the PDO extension in packages is built against PostgreSQL 13 while we use PostgreSQL 15.

Good to know. We maintain a package repository to put our own packages.

Example of upgrade

The general process is to go to the port directory, build it and install it. To avoid any reinstallation with wrong parameters, you can lock it.

To use the previous example:

   $ portsnap fetch update
   $ cd /usr/ports/databases/php82-pdo_pgsql
   $ pkg unlock php82-pdo_pgsql
   $ make clean build package deinstall reinstall
   $ pkg lock php82-pdo_pgsql

List locked packges

   $ pkg lock -l

Salt bootstrap

rOPS: utils/bootstrap/hello-FreeBSD.sh can be used to install Salt and connect to Complector.

Upgrade OS

You can use the freebsd-update utility:

   $ freebsd-update fetch
   […]
   No updates needed to update system to 13.2-RELEASE-p0.

For upgrade to a new version:

   $ freebsd-update upgrade -r 14.0-RELEASE

See also Updating and Upgrading FreeBSD in FreeBSD handbook.

When you upgrade packages, if php-fpm (php package) is touched, run:

   $ salt-call --local state.apply roles/webserver-alkane/php/service

If you are invited to upgrade the ZFS pool, please follow instructions form Operations_grimoire/ZFS.