Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk11 min

How to Use fpm to Build Packages in Multiple Formats on Linux

A practical guide to building .deb, .rpm, Pacman and Alpine packages with fpm, including shared .fpm configuration, source mappings, metadata, scripts, target differences and testing.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use fpm once for each package format, while keeping the files and shared metadata in one configuration. For a staged directory, select the input with -s dir, select an output with -t deb, -t rpm, -t pacman or another supported target, and map each source path to its destination. Put common options in a .fpm file, then override only the target-specific settings on each command line. This produces separate packages from the same source tree without copying a long command.

How fpm’s packaging model works

fpm treats packaging as a conversion between a source type and a target type. The source can be a directory, a Ruby gem, an npm module, a Python environment, an existing package, or another supported input. The target is the package format you want to distribute. The files or package named at the end of the command are the source inputs.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The practical model is:

fpm -s <source-type> -t <target-type> [metadata and file mappings] <source-input>

For example, -s dir tells fpm to read local files, while -t deb asks for a Debian package. The official guide summarizes this relationship as: “Given a source and a target, FPM can convert all the source files into a package of the target format.” You run the conversion once per output format; fpm does not emit a Debian and an RPM package from one invocation with a single -t value.

Prepare a clean staging tree

A staging directory should contain only the files intended for installation. Build it in a clean workspace rather than pointing fpm at a source-control checkout that may contain tests, editor files, build logs, or credentials.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
mkdir -p package-root/usr/bin package-root/usr/share/man/man1
cp build/hello-world package-root/usr/bin/hello-world
cp docs/hello-world.1 package-root/usr/share/man/man1/hello-world.1
chmod 0755 package-root/usr/bin/hello-world

When you pass a directory to fpm, the path on the left of an equals sign is read from the current filesystem and the path on the right becomes its installation path. A mapping such as package-root/usr/bin/hello-world=/usr/bin/hello-world therefore avoids ambiguity and makes the package contents easy to audit.

Map files explicitly

Explicit mappings are safer than handing fpm a broad directory when the staging tree may contain unrelated material. They also make a package review readable: each installed file has a visible destination.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
fpm -s dir -t deb 
  package-root/usr/bin/hello-world=/usr/bin/hello-world 
  package-root/usr/share/man/man1/hello-world.1=/usr/share/man/man1/hello-world.1

If you intentionally want to package the complete contents of a prepared tree, map the tree root to the filesystem root instead:

fpm -s dir -t deb package-root=/

Use that form only when every file below package-root belongs in the package.

Build a Debian package from a directory

The following command follows the documented fpm example and adds the metadata a usable package needs:

fpm 
  -s dir -t deb 
  -p hello-world-0.1.0-1-any.deb 
  --name hello-world 
  --license agpl3 
  --version 0.1.0 
  --architecture all 
  --depends bash 
  --depends lolcat 
  --description "Say hi!" 
  --url "https://example.com/hello-world" 
  --maintainer "You The Amazing Person <[email protected]>" 
  package-root/usr/bin/hello-world=/usr/bin/hello-world 
  package-root/usr/share/man/man1/hello-world.1=/usr/share/man/man1/hello-world.1

-p sets the output path and filename. --architecture all is appropriate for an architecture-independent script; compiled binaries normally need the architecture value matching the binary you built. Repeating --depends records each runtime dependency. Dependencies are package metadata, not files copied into your archive, so name packages available in the distributions you support.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Build both .deb and .rpm packages with one configuration

Put values shared by every target in a file named .fpm in the project directory. The file can contain source selection, package identity, dependencies, descriptive metadata, and mappings.

-s dir
--name hello-world
--license agpl3
--version 0.1.0
--architecture all
--depends bash
--depends lolcat
--description Say hi!
--url https://example.com/hello-world
--maintainer You The Amazing Person <[email protected]>
package-root/usr/bin/hello-world=/usr/bin/hello-world
package-root/usr/share/man/man1/hello-world.1=/usr/share/man/man1/hello-world.1

Then select a target and output filename for each build:

fpm -t deb -p hello-world-0.1.0-1-any.deb
fpm -t rpm -p hello-world-0.1.0-1.x86_64.rpm

Command-line options override values loaded from the .fpm file. Keep target-specific settings on the command line, or maintain separate option files when a format requires different dependency names, scripts, architecture notation, compression, or policy metadata. This arrangement gives both builds the same source mappings and release identity while leaving room for format-specific corrections.

Make the output name match the package metadata

The filename supplied with -p is an output path; it does not replace the internal name and version fields. Set --name and --version deliberately, then choose a filename that communicates the target and architecture. An RPM filename commonly includes a release and architecture, while a Debian filename often uses an all architecture marker for architecture-independent content. Verify the naming convention expected by the repository where you will publish the package.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Metadata you should set deliberately

Packaging is more than archiving files. Installers and repositories use metadata to decide where a package can be installed, what it depends on, and how it is upgraded.

Option Purpose What to decide
--name or -n Package identity Use the stable name that users and dependency resolvers should reference.
--version or -v Upstream version Use a consistent release scheme; do not let a stale default determine upgrade ordering.
--architecture or -a CPU or architecture-independent marker Use all for architecture-independent scripts and the actual build architecture for binaries.
--depends or -d Runtime dependency Repeat the option for every required package and use names valid for the target distribution.
--description Human-readable summary Explain what the installed software does, not how it was built.
--license License identifier or text Choose the identifier accepted by the repositories you target.
--url Project or documentation address Point to a maintained project page.
--maintainer Contact identity Provide a name and reachable address for package issues.
--config-files Marks files as administrator configuration List files that should be preserved or handled specially during upgrades.
--directories Declares directories that belong to the package Use when an empty directory must exist after installation.

Defaults can be convenient for a quick experiment but may not meet distribution policy. Set the version, iteration or release value, architecture, dependencies, maintainer, license, and URL explicitly for every release build.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Use lifecycle scripts carefully

Lifecycle scripts let a package perform actions before or after installation and upgrade. fpm’s CLI reference documents options including --before-install, --after-install, --before-upgrade, and --after-upgrade. Use a script file with the relevant option:

fpm -s dir -t deb 
  --before-install scripts/before-install.sh 
  --after-install scripts/after-install.sh 
  --before-upgrade scripts/before-upgrade.sh 
  --after-upgrade scripts/after-upgrade.sh 
  ...

The documented install, remove, and upgrade script family currently supports Debian, RPM, and Pacman packages. Do not assume that a script attached to one target will run with identical timing, arguments, environment, or failure behavior on another target. Test installation, upgrade, and removal on each distribution you support. Keep scripts idempotent, fail safely, and avoid destructive actions that are not required to activate the package.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build other target formats

Change only the target selection and output path when your shared metadata is valid for another format:

fpm -t pacman -p hello-world-0.1.0-1-x86_64.pkg.tar.zst
fpm -t apk    -p hello-world-0.1.0-r1.apk

These commands illustrate the workflow, not a promise that identical metadata is valid everywhere. Dependency names, architecture labels, compression defaults, script hooks, and repository rules differ by ecosystem. Inspect the generated package metadata for every target instead of assuming that a successful build means policy compliance.

Package inputs besides a directory

fpm can obtain or read metadata from several source types. The source type changes the first part of the command; the target-selection pattern remains the same.

Input Example shape Use case
NPM module fpm -s npm -t deb package-name Build a package from npm metadata and the named module.
Ruby gem fpm -s gem -t deb fpm Turn a gem into a Debian package; this is the documented example.
Python application fpm -s python -t deb ... Use Python packaging metadata as the source.
Python virtualenv fpm -s virtualenv -t rpm ... Package an existing virtual environment for a selected target.
CPAN or PEAR fpm -s cpan -t deb ... or fpm -s pear -t rpm ... Convert language-specific package inputs.
Existing package fpm -s deb -t rpm existing.deb Convert an existing Debian, RPM, or Pacman package to another target.
Archive fpm -s tar -t deb app.tar or fpm -s zip -t rpm app.zip Use an existing tar or zip archive as the file source.
Other supported inputs pkgin, empty packages Create packages from pkgin metadata or an intentionally empty package.

Supported output families include Debian, RPM, Pacman, Alpine packages, Solaris, FreeBSD, macOS package, Puppet, p5p, shell archive, tar, zip, and a directory tree. Availability and behavior depend on the installed fpm version and its format handlers, so check the command’s current help output in the build environment.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Understand the differences between targets

One source tree does not imply one universal package policy. Before publishing multiple formats, compare each target on these axes:

Axis Why it matters What to verify
Dependency names and versions Package managers use different names and version operators. Confirm that every dependency exists in the target distribution and that the generated constraint means what you intend.
Configuration files Upgrade tools may preserve administrator edits differently. Mark files with --config-files and inspect the target package metadata.
Lifecycle scripts Hook names, timing, and supported targets vary. Run install, upgrade, and removal tests on the actual operating systems.
Ownership and permissions Executables, service files, and configuration files need different modes and owners. Check the archive listing and install into a disposable system before release.
Compression Repository and tooling defaults are format-specific. Use target-specific compression settings where policy requires them.
Architecture names all, x86_64, and other labels are not interchangeable in every ecosystem. Use the architecture vocabulary expected by each package manager.
Repository and signing policy A locally buildable package may still be rejected by a repository. Apply the signing, naming, changelog, and metadata rules of each distribution.

fpm has dedicated handlers and options for Debian, RPM, Pacman, and Alpine targets. Treat those handlers as separate publication formats: build from shared inputs, then validate each result independently.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Reproducible and reviewable builds

For repeatable output, keep the staging tree deterministic and control timestamps where supported. The CLI reference documents --source-date-epoch-default and --source-date-epoch-from-changelog. The changelog-based option is described as experimental and currently implemented for gem input. No published reproducibility rate or benchmark is established by the documentation, so these flags should be treated as build controls rather than a guarantee that two packages will be byte-for-byte identical.

Record the exact fpm version, source revision, dependency inputs, architecture, and option file used for every release. Avoid embedding generated logs or timestamps in the staging tree. Build in a clean environment, retain the command line in build logs, and compare the generated metadata between targets.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Validate each package before publication

  1. Inspect the archive contents. Confirm that binaries, man pages, configuration files, service units, licenses, and documentation are at the intended paths. Look for accidental source files, private keys, test fixtures, and build directories.
  2. Inspect metadata per target. Check name, version, release or iteration, architecture, dependencies, description, URL, maintainer, license, configuration-file markers, and script hooks.
  3. Install in a disposable environment. Use a clean Debian system for the .deb, an RPM-based system for the .rpm, an Arch system for Pacman output, and an Alpine system for .apk output.
  4. Exercise the installed program. Run its normal command, verify file permissions and ownership, and confirm that declared runtime dependencies are sufficient.
  5. Test upgrades. Install the previous package, apply the new package, and verify that administrator configuration survives according to the target policy.
  6. Test removal. Remove the package and check which files are intentionally retained, especially configuration and state directories.
  7. Test failure paths. If scripts run, test interrupted or repeated installation so a second invocation does not corrupt state.
  8. Apply repository checks. Run the linting, signing, naming, and changelog checks required by every repository where the package will be published.

Common problems and fixes

The package contains unexpected files

Rebuild from an empty staging directory and replace broad tree mappings with explicit source-to-destination mappings. Check generated archives before installing them.

The package installs but the command cannot run

Check executable mode, interpreter paths, ownership, architecture, and runtime dependencies. A dependency listed in one ecosystem may have a different name in another, so inspect each target’s metadata rather than copying a Debian dependency list into an RPM or Alpine build unchanged.

An upgrade overwrites an administrator’s configuration

Mark the file with --config-files, then test an upgrade on the target distribution. Confirm that the package manager recognizes the file as configuration and that your upgrade scripts do not overwrite it directly.

A lifecycle script works for one format but not another

Verify that the target supports the script family, then test the script under that package manager’s environment and ordering rules. Keep target-specific script options outside the shared .fpm settings when behavior differs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The output architecture is rejected

Use the architecture label required by the target ecosystem. all is suitable for architecture-independent scripts in the documented Debian example, but a compiled executable should be labeled for the architecture it actually targets.

Two builds from the same source differ unexpectedly

Compare file timestamps, generated files, archive ordering, compression settings, fpm versions, and source-date options. Keep the staging process deterministic and record all inputs.

Recommended project layout

A small project can separate source files, packaging mappings, scripts, and target commands:

packaging/
  .fpm
  scripts/
    before-install.sh
    after-install.sh
  build-deb.sh
  build-rpm.sh
package-root/
  usr/bin/hello-world
  usr/share/man/man1/hello-world.1

Put only settings common to every package in packaging/.fpm. Keep Debian-, RPM-, Pacman-, or Alpine-specific dependency names, scripts, compression, and output paths in their respective build scripts. This gives reviewers one stable source of file mappings while making intentional target differences visible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When converting an existing package makes sense

Using an existing .deb, .rpm, or Pacman package as an fpm input can save time when the original package already contains the desired file layout and metadata. It does not remove the need for target validation. Conversion can lose or reinterpret fields that have no direct equivalent, and dependency names, script behavior, configuration handling, and signing requirements still belong to the destination ecosystem. Treat the converted artifact as a new package: inspect it, install it, upgrade it, and remove it on the destination distribution.

A repeatable multi-format release sequence

  1. Set the release version and architecture for the source you are shipping.
  2. Create a clean staging tree and copy only release files into it.
  3. Write shared identity, dependency, description, maintainer, license, URL, and mappings in .fpm.
  4. Build the Debian package with fpm -t deb -p ....
  5. Build the RPM package with fpm -t rpm -p ....
  6. Run equivalent commands for Pacman, Alpine, or another target you support, adding target-specific options as needed.
  7. Inspect every archive and its metadata separately.
  8. Install, upgrade, exercise, and remove each package on its corresponding distribution.
  9. Sign and publish only the artifacts that satisfy the destination repository’s policy.

This workflow keeps one authoritative description of the application files while acknowledging that package formats are not interchangeable. fpm supplies the conversion mechanism; your staging discipline, metadata choices, and per-distribution tests determine whether the resulting packages are safe to ship.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.