Overview
Linux systems are primarily divided into two package management systems: Red Hat-based (RPM) and Debian-based (deb). These formats are not natively compatible. The alien command allows you to convert package files between these formats, enabling you to install software that might not be natively available for your distribution. This tool is invaluable when, for example, you are using Ubuntu but need a specific piece of software that is only distributed in RPM format.
Specifications (Arguments and Options)
Syntax
alien [options] [source_file_name]
Conversion Format Options
These options specify the target format for the conversion.
| Option | Description |
| -d / –to-deb | Converts to deb format (Debian, Ubuntu, etc.). This is the default. |
| -r / –to-rpm | Converts to RPM format (RHEL, CentOS, Fedora, etc.). |
| -t / –to-tgz | Converts to tgz format (Slackware or a simple compressed archive). |
| -p / –to-pkg | Converts to pkg format (Solaris). |
Other Main Options
| Option | Description |
| -i / –install | Automatically installs the converted package into the system. |
| –bump=number | Increments the package version (release number) during conversion. |
| –description=string | Changes the package description to the specified string. |
| -T / –test | Tests the conversion scripts without actually converting the file. |
| –target=architecture | Forces a specific target architecture (e.g., amd64, i386). |
Main Formats Supported by alien
| Format | Description |
| RPM | Used by Red Hat Enterprise Linux, CentOS, AlmaLinux, Fedora, etc. |
| deb | Used by Debian, Ubuntu, Kali Linux, Linux Mint, etc. |
| tgz | Used by Slackware or as a general tar+gzip archive. |
| pkg | Package format used by Solaris OS. |
Basic Usage
To convert an RPM package (e.g., sl-5.02-1.el8.x86_64.rpm) into a deb package for use on Ubuntu, use the following command. The -d option is assumed by default.
# Convert an RPM file to a deb file
sudo alien --to-deb sl-5.02-1.el8.x86_64.rpm
Example Output:
sl_5.02-2_amd64.deb generated
The converted file is generated in the same directory as the source file.
Practical Commands
Converting from a deb Package to an RPM Package
Conversely, you can convert an Ubuntu package for use on a system like CentOS.
# Convert a deb file to an RPM file
sudo alien --to-rpm sl_5.02-1_amd64.deb
Example Output:
sl-5.02-2.x86_64.rpm generated
Converting and Installing an RPM Package Immediately
This command performs the conversion and the installation (via dpkg -i) in one step. This is useful for quickly testing RPM software in an Ubuntu environment.
# Execute conversion and installation at the same time
sudo alien -i sl-5.02-1.el8.x86_64.rpm
Example Output:
sl_5.02-2_amd64.deb generated
Selecting previously unselected package sl.
(Reading database ... 20543 files and directories currently installed.)
Preparing to unpack sl_5.02-2_amd64.deb ...
Unpacking sl (5.02-2) ...
Setting up sl (5.02-2) ...
Converting to Multiple Formats Simultaneously
You can generate both an RPM file and a tgz file from a single deb file at once.
# Convert to RPM and tgz formats simultaneously
sudo alien --to-rpm --to-tgz sl_5.02-1_amd64.deb
Customization Points
Incrementing Version Numbers (–bump)
When converting the same package multiple times, use this to automatically increase the release number. This prevents installation errors caused by duplicate versions.
alien --to-deb --bump=1 package.rpm
Specifying Architecture (–target)
Use this option in cross-platform development when you need to output a package for a different CPU architecture.
alien --to-deb --target=arm64 package.rpm
Important Notes
Dependencies are Not Resolved
The alien command only repackages binary files and directory structures. It does not convert or resolve the “libraries (dependencies)” required by the source package. It is common to encounter “library not found” errors when running the converted software.
Missing Installation Scripts
Configuration scripts such as pre-install or post-install included in RPMs or debs are often ignored or fail to run correctly after conversion. Therefore, alien is not suitable for complex packages that deeply modify system settings, such as databases or web servers.
Need for Root Privileges
To correctly preserve file ownership and permissions, it is highly recommended to run the alien command with sudo (root privileges).
Advanced Usage
Converting to tgz Format and Extracting Contents
If you do not want to install a package but need to extract a specific binary file from it, converting it to the general tgz format and then decompressing it is the fastest method.
# Convert to tgz
sudo alien --to-tgz proprietary-driver.rpm
# Decompress and check the contents
tar zxvf proprietary-driver.tgz
Summary
The alien command is a powerful bridge for using software across different Linux distributions. However, it is not a perfect universal converter and should be understood as a simple porting tool. It is best used as a last resort for standalone tools with few dependencies or for older software that lacks an official package for your specific distribution.
