Build Snapper for AlmaLinux 10.1

Preparation

Make sure your system is updated and that you have a Btrfs or LVM with thin provisioning filesystem.

Check your filesystem type:

sudo btrfs subvolume list /

Update your system and install EPEL repository:

sudo dnf update -y
sudo dnf install epel-release -y

Install Build Dependencies

Snapper has several library dependencies. Install the C++ toolchain and the required development headers:

sudo dnf install -y \
    git \
    make \
    autoconf \
    automake \
    libtool \
    gcc-c++ \
    boost-devel \
    dbus-devel \
    libxml2-devel \
    libmount-devel \
    libacl-devel \
    btrfs-progs-devel \
    json-c-devel \
    ncurses-devel \
    pam-devel \
    gettext-devel \
    docbook-style-xsl \
    libxslt \
    pkgconf-pkg-config

Clone and Build Snapper

git clone https://github.com/openSUSE/snapper.git
cd snapper

Generate the build system

make -f Makefile.repo

Configure the build

./configure --prefix=/usr  --sysconfdir=/etc/sysconfig/snapper

Compile and Install

make -j$(nproc)
sudo make install

Setup

Enable Snapper Timers

sudo systemctl enable --now snapper-timeline.timer
sudo systemctl enable --now snapper-cleanup.timer

Configure Snapper

Copy the default config template and edit it:

sudo cp /usr/share/snapper/config-templates/default /etc/snapper/configs/root

Check to see if the config file copied:

sudo vi /etc/snapper/configs/root

Create the snapshots directory:

sudo rm -rf /.snapshots
sudo btrfs subvolume create /.snapshots

Configure Snapper Settings

Create /etc/sysconfig/snapper and add the config line below:

sudo vi /etc/sysconfig/snapper
SNAPPER_CONFIGS="root"

For more configuration options, see the snapper-configs manual page.

Apply SELinux Contexts

Label the Snapper binaries, configs, and snapshots directory:

sudo restorecon -Rv /usr/sbin/snapperd
sudo restorecon -Rv /etc/snapper
sudo restorecon -Rv /.snapshots

Verifying the Installation

Check that Snapper is working correctly:

sudo snapper list-configs
sudo snapper -c root list

Or

Thanks to Andrey Smirnov for packaging Snapper for AlmaLinux 10.1, which can be found here Snapper for AlmaLinux 10.1

Automatic Snapshots Before/After package changes

Coming soon...