- Linux Blog
- How to convert between packages (deb, rpm, tgz) using alien on Linux
- 3 comments:
- How to Convert DEB Files to RPM
- How to convert DEB files to RPM
- Conclusion
- How to Convert From RPM to DEB and DEB to RPM Package Using Alien
- Step 1: Installing Alien and Dependencies
- Step 2: Converting from .deb to .rpm Package
- Step 3: Converting from .rpm to .deb Package
- Summary
- If You Appreciate What We Do Here On TecMint, You Should Consider:
- Use alien to convert Deb to RPM (and RPM to Deb)
- Installing Alien
- Installation on Debian systems
- Installation on Redhat systems
- Converting an RPM to Debian package with Alien
- Converting a Debian package to RPM with Alien
- How does Alien work?
- Common Alien issues
- Dependency Chain
- Post/Pre/Uninstall scripts
- Service initialization
- Useful Alien options
- Conclusion
Linux Blog
How to convert between packages (deb, rpm, tgz) using alien on Linux
alien is a program that converts between Redhat rpm, Debian deb, Stampede slp, Slackware tgz, and Solaris pkg file formats. If you want to use a package from another linux distribution than the one you have installed on your system, you can use alien to convert it to your preferred package format and install it. It also supports LSB packages
Warning:
Alien should not be used to replace important system packages, like init, libc, or other things that are essential for the functioning of your system. Many of these packages are set up differently by the different distributions, and packages from the different distributions cannot be used interchangeably. In general, if you can’t remove a package without breaking your system, don’t try to replace it with an alien version.
Installation:
Ubuntu user can install alien using following command: apt-get install alien
OpenSuSe user can install alien using «1-click» installer — here
Fedora user can install alien using command: yum install alien
Examples
Convert the package.rpm into a package.deb
alien —to-deb package.rpm
Convert the package.deb into a package.rpm
alien —to-rpm package.deb
Convert the package.rpm into a package.deb (converting to a .deb package is default, so you need not specify —to-deb), and install the generated package.
alien -i package.rpm
alien —to-deb —to-rpm —to-tgz —to-slp foo.deb bar.rpm baz.tgz
Creates 9 new packages. When it is done, foo bar and baz are available in all 4 package formats.
3 comments:
i can’t seem to install alien using «yum install alien». yum says it can’t find the package.
Same for me on Linux Mint 14 after entering:
«Sudo alien -d -i .tar.gz» or
«Sudo alien -d -i .rpm».
Can alien be used for packages downloaded through a browser to something like the downloads folder or does it need to exist in a specific file/medium?
Works great on Linux mint mate, converting was no problem, transferred to another machine using cinnamon, installed no problem but where’d it go, not in menu?
Источник
How to Convert DEB Files to RPM
RPM-based distributions are great. They offer a different way of doing things compared to Debian-based ones. Still, if you’re using one, you’ll no doubt be aware of its single greatest weakness – package availability. RPMs are just not as abundant as DEB files. It’s a fact.
Some users have combated this in a few ways: the OpenSUSE build service or by using repositories like RPMFusion. For the most part, this helps close the gap. However, sometimes this just doesn’t cut it. Sometimes you still need a package, and you can’t find it anywhere.
Sure, you can always find the source of the program you want to install and compile it on your own, but sometimes that’s just not going to happen, especially for proprietary programs. Most of the time those kind of programs are only released with binary packages, so compiling them is out of the question.
How do we solve this issue? Simple. Just convert the package files to the format you need using Alien. It allows you to take one package of one format and convert it to another format. For the most part, doing this works. Most of the time packages get converted and can be installed with no problem. Other times their are errors. Try this at your own risk.
How to convert DEB files to RPM
Before we begin, you’ll need Alien. Check your distro’s repository. It may be in there. If not, get it here. You’ll need to look for the package specific to your operating system.
Once you’ve got it downloaded, install it and then open a terminal window.
Find the Deb package you’d like to convert and download it to your PC. Once you’ve got it downloaded, go back to the terminal you opened previously. Then, just enter the command below.
You’ll notice that in the command above, there’s more than one switch. Most people, when using alien to convert DEB to RPM, only use the -r switch. It’s not enough. This switch only tells the program to convert the package. If you add the -c and -v switch to the command, things will go a lot smoother (most of the time).
The -c switch will include all of the scripts that may or may not be inside the package. Most of the time, you’ll want to use this switch. It will help with converting packages better. Sometimes packages don’t come with scripts included, or just don’t work with the -c switch. In this case, just don’t use it. Do some experimentation.
There’s another switch that most people won’t use either. It’s -v . What does it do? It’ll display each and every command that Alien runs during the conversion. This will allow you to troubleshoot the conversion process.
Once you run the command, if successful, your new RPM file will be created, and after which, you’ll be able to take it and install it to your system. It’ll be located in the exact same place that the DEB file is. The RPM file will have the exact same name too.
Conclusion
Alien is a very useful program. It helps close the massive gap that has been plaguing Redhat-based distributions for a very long time. Perhaps one day the time will come when developers recognize RPMs just as much a DEBs. Until then, this program will always serve a purpose.
Derrik Diener is a freelance technology blogger.
Источник
How to Convert From RPM to DEB and DEB to RPM Package Using Alien
As I’m sure you already know, there are plenty of ways to install software in Linux: using the package management system provided by your distribution (aptitude, yum, or zypper, to name a few examples), compiling from source (though somewhat rare these days, it was the only method available during the early days of Linux), or utilizing a low level tool such as dpkg or rpm with .deb and .rpm standalone, precompiled packages, respectively.
Convert RPM to DEB and DEB to RPM Package Using Alien
In this article we will introduce you to alien, a tool that converts between different Linux package formats, with .rpm to .deb (and vice versa) being the most common usage.
This tool, even when its author is no longer maintaining it and states in his website that alien will always probably remain in experimental status, can come in handy if you need a certain type of package but can only find that program in another package format.
For example, alien saved my day once when I was looking for a .deb driver for a inkjet printer and couldn’t find any – the manufacturer only provided a .rpm package. I installed alien, converted the package, and before long I was able to use my printer without issues.
That said, we must clarify that this utility should not be used to replace important system files and libraries since they are set up differently across distributions. Only use alien as a last resort if the suggested installation methods at the beginning of this article are out of the question for the required program.
Last but not least, we must note that even though we will use CentOS and Debian in this article, alien is also known to work in Slackware and even in Solaris, besides the first two distributions and their respective families.
Step 1: Installing Alien and Dependencies
To install alien in CentOS/RHEL 7, you will need to enable the EPEL and the Nux Dextop (yes, it’s Dextop – not Desktop) repositories, in that order:
The latest version of the package that enables this repository is currently 0.5 (published on Aug. 10, 2015). You should check http://li.nux.ro/download/nux/dextop/el7/x86_64/ to see whether there’s a newer version before proceeding further:
In Fedora, you will only need to run the last command.
In Debian and derivatives, simply do:
Step 2: Converting from .deb to .rpm Package
For this test we have chosen dateutils, which provides a set of date and time utilities to deal with large amounts of financial data. We will download the .deb package to our CentOS 7 box, convert it to .rpm and install it:
Check CentOS Version
Convert .deb to .rpm package in Linux
Important: (Please note how, by default, alien increases the version minor number of the target package. If you want to override this behavior, add the –keep-version flag).
If we try to install the package right away, we will run into a slight issue:
Install RPM Package
To solve this issue, we will enable the epel-testing repository and install the rpmrebuild utility to edit the settings of the package to be rebuilt:
Which will open up your default text editor. Go to the %files section and delete the lines that refer to the directories mentioned in the error message, then save the file and exit:
Convert .deb to Alien Version
When you exit the file you will be prompted to continue with the rebuild. If you choose Y, the file will be rebuilt into the specified directory (different than the current working directory):
Build RPM Package
Now you can proceed to install the package and verify as usual:
Install Build RPM Package
Finally, you can list the individual tools that were included with dateutils and alternatively check their respective man pages:
Verify Installed RPM Package
Step 3: Converting from .rpm to .deb Package
In this section we will illustrate how to convert from .rpm to .deb. In a 32-bit Debian Wheezy box, let’s download the .rpm package for the zsh shell from the CentOS 6 OS repository. Note that this shell is not available by default in Debian and derivatives.
Check Shell and Debian OS Version
You can safely disregard the messages about a missing signature:
Convert .rpm to .deb Package
After a few moments, the .deb file should have been generated and be ready to install:
Install RPM Converted Deb Package
After the installation, you can verify that zsh is added to the list of valid shells:
Confirm Installed Zsh Package
Summary
In this article we have explained how to convert from .rpm to .deb and vice versa to install packages as a last resort when such programs are not available in the repositories or as distributable source code. You will want to bookmark this article because all of us will need alien at one time or another.
Feel free to share your thoughts about this article using the form below.
If You Appreciate What We Do Here On TecMint, You Should Consider:
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
Источник
Use alien to convert Deb to RPM (and RPM to Deb)
Oct 26, 2015 • packagecloud
Alien is a command line tool that allows you to convert Debian packages to RPM packages, and vice versa. This blog post will illustrate how to convert a Debian package to an RPM and similarly, how to convert an RPM package to a Debian package.
Installing Alien
Installation on Debian systems
alien can usually just be installed using apt-get on most Debian based systems. You’ll also want fakeroot .
Installation on Redhat systems
You’ll need the following dependencies installed.
Note: to convert RPM to Debian Packages, you’ll need to install all the Debian tools (dpkg, dpkg-dev, debhelper), which is non-trivial on Redhat systems, so we recommend just finding a Debian system instead.
Extract the xz archive.
Visit the newly extracted directory.
Generate the Makefile .
Run the Makefile .
Install the alien tool:
Converting an RPM to Debian package with Alien
For the example RPM package, we’ll download our packagecloud-test-1.1-1.x86_64.rpm package, from the packagecloud-test-packages repository.
Now, just run alien on it (using fakeroot ).
Note how it correctly changed RPM’s architecture x86_64 to the Debian nomenclature: amd64 .
You should now have a packagecloud-test_1.1-2_amd64.deb package in that same directory.
Let’s just install it with dpkg -i .
Finally, you should be able to run our packagecloud_hello program to verify everything worked.
Converting a Debian package to RPM with Alien
For the example Debian package, we’ll download our packagecloud-test_1.1-2_amd64.deb package from the packagecloud-test-packages repository.
Again, we run alien on it (in a fakeroot ), but this time with the —to-rpm flag.
You should now have a packagecloud-test-1.1-3.x86_64.rpm package in that same directory.
Let’s install that RPM on a Redhat based system.
Finally, you should be able to run our test program to verify everything worked.
How does Alien work?
Because Debian and RPM packages are a special kind of archive, automatically transforming between them is possible. For example, to transform an RPM to a Debian package, you would move the contents of an RPM cpio archive, to an ar archive.
Common Alien issues
It’s important to note that since Alien is just converting between package archive formats, the package you get may not always install, or work as desired, once installed.
Dependency Chain
It’s entirely possible that the original package dependency chain differs from the desired target system. For instance, a binary in the original package was linked against glibc-2.8 but the target system only has glibc-2.1 installed. It’s unlikely this package will work, and you might have to build a native RPM or Debian package instead.
Post/Pre/Uninstall scripts
Debian and RPM packages have shell scripts that can run before and/or after your install (during uninstall, also). By default, Alien will not include these in the converted package, as there is a high likelihood scripts written for RPM packages won’t work for a Debian system, and vice versa. It might be worth inspecting your original Debian or RPM package to see if the included scripts will work and passing —scripts to Alien, if so.
Service initialization
Converting service packages (like redis, apache, mysql, etc) with Alien is tricky because these packages tend to register themselves with the initialization service provided by the native operating system. For example, newer Ubuntu packages will want to use systemd instead of upstart or sysvinit, which is what Redhat systems usually want. The package will install successfully, but the service will not be running, as expected.
Useful Alien options
If you want to bump the version number, you can use —bump=number .
To munge/fix permissions, you can use —fixperms .
Install scripts are not included by default, but you can include them using —scripts .
You can run lintian (must already be installed) on the generated Debian package by using —test .
Note: Running —test with —to-rpm does not run rpmlint , as you may expect.
Conclusion
While finding or building native Debian or RPM packages is ideal, it’s still useful to know how to convert between them in a pinch. Be sure to check out the official alien website for more information.
Источник