Today I discovered that the version of collectd that ships with Ubuntu Lucid has trouble with HTTP basic authentication. To verify, I grabbed the latest tarball, which is several revisions beyond the Ubuntu package… and it worked. So what do I do now? Debian packages are fast, easy to distribute, and work well with Chef… but they are a pain in the ass to build for people who don’t do it regularly.
Enter FPM, or “Effing Package Management”. Jordan Sissel built this so he didn’t have to fight with the package process any longer. Kudos to him, because this freed up my afternoon.
Just so one more example gets out there, here is how you can use it.
First off, grab the tarball of the software you want to convert into a package. I am going with collectd here, but anything that follows the traditional make install route ought to work. Go ahead and run ./configure and make install. I’ll wait.
As it stands now, collectd installs in /opt/collectd out of the box. Assuming that is how we want to keep it for production, we can go ahead and build our custom package.
Now install fpm:
$ gem install fpm
Build your deb with the following commands:
$ fpm -n collectd -v 4.9.4-custom-1 -t deb -s dir /opt/collectd
A little explanation will go a long way here. -n gives the new package a name. -v allows us to state the version. I appended -custom-1 as that should help me distinguish from the vendor. -t lets me specify the package type, such as rpm or deb. -s dir states that I am building my package from the contents of a directory. Finally, the last item tells fpm which directory to build from.
Clear?
Upon completion, you should have a fresh deb in your directory. I installed mine like so:
$ sudo dpkg -i collectd_4.9.4-custom-1_i686.deb
Big thanks to Jordan for making life better for all of us.