A primer on how to package SiLK as an RPM.

What's New in SiLK 3.23

The process for packaging SiLK into a set of RPMs has been overhauled as of SiLK 3.23.

In SiLK 3.22 and earlier, RPM features were controlled via the same configure script call that created the silk.spec file. That is, you would decide on the features you wanted to enable or disable, run ./configure with the appropriate arguments, and use the generated silk.spec file to build an RPM with those features. To choose different options, you would either repeat that process or edit the silk.spec file by hand.

As of SiLK 3.23, a standard silk.spec file is included with the SiLK distribution (and created as part of making a distribution), and most build options are passed to rpmbuild as feature flags (--with FEATURE1 or --without FEATURE2) when building the packages. Some build customization requires editing the silk.spec file.

The new method for building SiLK as an RPM simplifies this process and adds new functionality as well.

When packaging SiLK as an RPM, python3 is now explicity defined as the python version in the spec file.

Packaging Process

Step 1

To create an RPM, you need a SiLK distribution file such as silk-3.23.0.tar.gz and the matching specification file ("spec file"), silk.spec.

If you have downloaded the SiLK distribution file (tarball) from the NetSA Tools site, you may fully expand it and copy out the silk.spec file. You may also extract only the silk.spec file with this series of commands where the name of the spec file is the final argument to the tar command. (The dollar sign ($) represents your shell's prompt.)

$ tar zxf silk-3.23.0.tar.gz silk-3.23.0/silk.spec
$ mv silk-3.23.0/silk.spec silk.spec
$ rmdir silk-3.23.0

Alternatively, you may create the silk.spec file (and a distribution file if needed) from within the project directory after running ./configure:

$ ./configure
$ make silk.spec
$ make dist

Step 2

If desired, edit the silk.spec file to customize the build. See the Additional Customizationsection below.

Step 3

Copy the distribution file and the spec file to your rpmbuild SOURCES and SPECS directories, respectively.

Step 4

Run rpmbuild with the -ba (build all) option. To specify whether you want a feature to be enabled, use the --with or --without flags and the name of the feature. The Feature Flags section below describes the feature flags and their default states.

For example, to package SiLK with PySiLK support and without IPv6 or libfixbuf, run this command:

rpmbuild -ba /path/to/SPECS/silk.spec --with pysilk --without ipv6 \
    --without libfixbuf

If you enabled a feature that is not enabled by default, you will see the name of the flag in the release section of the package name. If you disabled a feature that is enabled by default, you will see the name of the package, preceded by a no (except --without ipv6 is indicated as ipv4. For example, the above rpmbuild command would produce this rpm:

silk-common-3.23.0-1_ipv4_pysilk_noIPFIX.el9.x86_64.rpm

This naming system allows package builders and installers to quickly determine what non-standard functionality a SiLK package has, as well as prevent SiLK packages with differing builds from being installed together.

Feature Flags

The currently implemented feature flags are as follows:

ipv6
Whether to include support for IPv6 addresses in flow records and IPsets. (Default: Enabled)
localtime
Whether to use the local timezone when printing and parsing timestamps. (Default: Disabled)
gnutls
Whether to include the GnuTLS library which supports TLS communication between rwsender and rwreceiver. (Default: Enabled)
libfixbuf
Whether to support IPFIX and NetFlow-v9 records via the libfixbuf library. (Default: Enabled)
libmaxminddb
Whether to support Country Code support with the MaxMind GeoIP library. (Default: Disabled)
pysilk
Whether to build PySiLK support. PySiLK allows the core SiLK tools to use plug-ins written in Python, and it also implements the import silk feature from within Python. (Default: Disabled)
snappy
Whether to build with support for the Snappy compression library. (Default: Disabled)

Additional Customization

Feature-flags only allow toggling a feature on or off, unfortunately. For customization that requires an argument, it is necessary to edit the silk.spec file.

These customization values are available and appear near the top of the silk.spec file:

data_rootdir

The data_rootdir setting specifies the compiled-in root for the SiLK flow record repository. SiLK requires a fallback default which is /data.

%define data_rootdir     /data

packing_logic

The packing_logic value controls whether the packing-logic for rwflowpack is compiled into the application or is loaded as a run-time plugin. To use a compiled-in value, use one of the C files in the site directory; for example:

%define packing_logic  site/twoway/packlogic-twoway.c

The default is to choose the packing-logic via a plug-in by leaving packing_logic undefined or setting it to %{nil}.

%define packing_logic  %{nil}

file_compression

This controls whether SiLK binary files are compressed and optionally what compression method to use. SiLK supports the following subject to the required library being available: none (default), zlib, lzo1x, snappy.

%define file_compression  %{nil}

ipset_compat

The ipset_compat setting determines the backward compatibility for IPset files generated by this release of SiLK.

Versions of SiLK older than the value specified here will be unable to read IPset files generated by the SiLK you are building now. The meaningful options are 1.0.0 (default), 3.7.0, 3.14.0.

If all your SiLK installations are newer than 3.14, you may safely set this to 3.14.0.

%define ipset_compat  %{nil}

Notes and Troubleshooting

To recreate the silk.spec file as it appeared in the distribution, run make silk.spec. If that results in the error:

make: *** No rule to make target silk.spec.  Stop.

then run ./configure to generate a Makefile and try the above command again.

If running make dist fails with errors about the UID, your user ID may exceed the value allowed in the original tar standard. This can be fixed by modifying the call slightly to

make dist TAR_OPTIONS='--owner=0 --group=0'

The previous command assumes the GNU version of tar.

Note: Building RPMs using mock will not work properly with feature flags.