← Back to jordansissel/fpm

How to Deploy & Use jordansissel/fpm

FPM - Effing Package Management

Prerequisites

Before installing FPM, ensure you have the following:

  • Ruby (version 1.9 or higher, though 1.8 support was deprecated)
  • RubyGems package manager
  • Build tools for your platform (gcc, make, etc.)
  • Package development tools depending on your target platform:
    • For RPM: rpm-build or rpmbuild
    • For DEB: dpkg-dev
    • For Solaris: pkgbuild

Installation

Via RubyGems (Recommended)

gem install fpm

From Source

git clone https://github.com/jordansissel/fpm.git
cd fpm
gem build fpm.gemspec
gem install fpm-*.gem

Verify Installation

fpm --version

Configuration

FPM doesn't require extensive configuration, but you can customize behavior through:

Environment Variables

  • DEBUG=1 - Enable debug output
  • CABIN_LEVEL=debug - Set logging level to debug

Command Line Options

Key options available for most package types:

# General options
fpm -s SOURCE_TYPE -t TARGET_TYPE [options]

# Common options
-C, --chdir DIR          Change directory before searching for files
-p, --package PATH       Output package file path
-f, --force              Overwrite existing files
--prefix PREFIX          Prefix for file paths in package

# Package metadata
--name NAME              Package name
--version VERSION        Package version
--iteration ITERATION    Package iteration/release
--description DESC       Package description
--maintainer EMAIL       Package maintainer

Build & Run

Basic Usage

# Create a DEB package from a directory
fpm -s dir -t deb -n myapp -v 1.0 /path/to/files

# Create an RPM package from a Python package
fpm -s python -t rpm Django

# Create a DEB package from a CPAN module
fpm -s cpan -t deb --cpanm-bin /usr/local/bin/cpanm Some::Module

Package-Specific Examples

Python Packages

# Install Django as a DEB package
fpm -s python -t deb Django

# Custom Python installation
fpm -s python -t rpm --pip /usr/bin/pip --pypi https://my.pypi.server/simple MyPackage

CPAN Packages

# Install a CPAN module as an RPM
fpm -s cpan -t rpm --mirror http://cpan.mirror/ Some::Module

RPM Conversion

# Convert an RPM to a DEB package
fpm -s rpm -t deb package.rpm

Deployment

FPM packages can be deployed to various platforms depending on the target format:

DEB Packages

  • Ubuntu/Debian: Use apt or dpkg
  • AWS: Deploy to EC2 instances with package managers
  • Docker: Include in Dockerfile with apt-get install

RPM Packages

  • Red Hat/CentOS/Fedora: Use yum or dnf
  • SUSE: Use zypper
  • AWS: Deploy to RHEL-based instances

Universal Deployment

For maximum compatibility, consider:

# Create multiple package formats simultaneously
fpm -s dir -t deb,rpm -n myapp -v 1.0 /path/to/files

Troubleshooting

Common Issues

Permission Denied

# Run with sudo if needed
sudo fpm -s dir -t deb -n myapp -v 1.0 /path/to/files

Missing Dependencies

# For RPM builds
sudo yum install rpm-build

# For DEB builds
sudo apt-get install dpkg-dev

Ruby Version Issues

# Check Ruby version
ruby --version

# If using Ruby 1.8, upgrade to 1.9+

Package Already Exists

# Use --force to overwrite
fpm -s dir -t deb -n myapp -v 1.0 /path/to/files --force

Invalid Package Type

# Check available package types
fpm --help

# Available types include: dir, rpm, deb, python, gem, npm, pear, etc.

Debug Mode

Enable debug output for troubleshooting:

DEBUG=1 fpm -s dir -t deb -n myapp -v 1.0 /path/to/files

Support

Known Limitations

  • CPAN support requires Ruby 1.9 or higher
  • Some package types may have platform-specific dependencies
  • Complex dependency resolution may require manual intervention

For specific package type issues, consult the relevant section in the FPM documentation or source code for detailed options and behaviors.