Building collectd Debian Packages

Tips on building collectd Debian package

Building collectd Debian Packages

This is follow on from post on building collectd on Ubuntu.

If you want to use collectd on Ubuntu machines then the easiest way to get going is do do an apt install. However the current release is 8.x which is way out of date, so to get easy current Ubuntu install you will need to build your own debian package. At this point this is a bit "handrolic" but I have documenting examples steps as we wont be able to provide fully automated build unless we understand the basic process.

Preliminary requirement for Debian Package build is to get the packaging tools. These are in build-essential:

# sudo apt install build-essential

Here is set of steps to build Debian 5.9.2 release (most current as of 25 October 2019):

# mkdir build-collectd
# cd build-collectd/
# git clone https://github.com/collectd/collectd.git
# cd collectd/
# git checkout collectd-5.9.2
# git tag -a collectd-5.9.2-1 -m "Add 5.9.2 tag"
# ./build.sh 
# ./configure
# make dist
# cd ..
# ln -s collectd/collectd-5.9.2.1.tar.bz2 collectd_5.9.2.orig.tar.bz2
# git clone https://github.com/zebity/pkg-debian.git
# bzcat collectd_5.9.2.orig.tar.bz2 | tar xvf - -C pkg-debian --strip-components=1
# cd pkg-debian/
# dpkg-buildpackage -us -uc
# cd ..
# ls
collectd                          collectd_5.9.2-1_amd64.deb      collectd_5.9.2.orig.tar.bz2      collectd-dev_5.9.2-1_all.deb          libcollectdclient-dev_5.9.2-1_amd64.deb
collectd_5.9.2-1_amd64.buildinfo  collectd_5.9.2-1.debian.tar.xz  collectd-core_5.9.2-1_amd64.deb  collectd-utils_5.9.2-1_amd64.deb      pkg-debian
collectd_5.9.2-1_amd64.changes    collectd_5.9.2-1.dsc            collectd-dbg_5.9.2-1_amd64.deb   libcollectdclient1_5.9.2-1_amd64.deb

You will notice the hacks to:

  • tag collectd-5.9.2 branch/tag, this is due to it not being tagged with annotation and this is required to generate the source tar with right name: collectd-5.9.2..tar.bz2 (the file name just follows git annoted tag)
  • git clones from both upstream master (https://github.com/collectd/collectd.git) which is all ready to go and my personal for of pkg_debian (https://github.com/zebity/pkg-debian.git) because the pull request for getting this updated has not been completed yet
  • symlinks to provide files names that pkg_debian likes and again the actual version of debian files is based on git annoted tags.

Files requiring updating with pkg_debian were: debian/rules, changelog and patches. See pull request here:  Debian 5.9.1 / 5.9.2 Package Build Candidate.


References & Links:

Debian Packaging Guide - ready this give you an idea of rather complicated process to build debian package

Ubuntu Packaging Guide - reuses the Debian packaging method and tools