Package Construction Using fpm

Learn how to create a package using fpm.

Example package creation

Let’s say we want to create a Debian package for the npm module leftpad. We’d run the following commands:

$ sudo apt install npm
$ fpm -s npm -t deb leftpad
  • With -s, we specify the source, here npm.

  • With -t deb, we instruct fpm to create a Debian package as the target.

  • Finally, leftpad is the name of the source package, which fpm downloads (through the npm executable) and packages into a Debian package.

Our node-leftpad_0.0.1_amd64.deb package is created successfully with the following message:

Created package {:path=>"node-leftpad_0.0.1_amd64.deb"}

fpm knows the Debian convention of prepending node- to the npm package name to create a Debian package name.

Installing a package

Let’s install the package we created and explore it a bit. These commands can be tried out in the playground below.

$ sudo dpkg -i node-leftpad_0.0.1_amd64.deb

The following output would indicate that our package is installed successfully:

Get hands-on with 1400+ tech skills courses.