RPMREBUILD

RPMREBUILD - rpmrebuild is a tool to build an RPM file from a package that has already been installed. It can be used to easily build modified packages, and works on any Linux distribution that uses RPM.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

rpmrebuild synopsis...

As the name suggests, it's a tool for rebuilding RPMs, which it does by reconstructing the package from files installed on your system and information in the RPM database.

Let's say you've downloaded and installed a package that you want to install on another machine — but you can't find it, or the server it's hosted on is down, or maybe you've done some customization to package and you'd prefer to distribute that version rather than building an RPM from scratch. That's where rpmrebuild comes in — it will create a new RPM from what's on your system, so that you don't need to find the old RPM to be able to install the package on other machines or have to create a brand new RPM from scratch.

There are tools with RPM that allow you to rebuild a package, but it needs to be uninstalled first. That's not exactly optimal. All you need to do to install rpmrebuild is to fetch the RPM (natch) from SourceForge and install it. (Of course, you will need to use a distro with RPM packages to make use of it.)

Once it's installed, you can reconstruct a package with rpmrebuild package. If you want to edit the specfile for some reason, you can do so with rpmrebuild -e package. This will open the specfile in your favorite editor — well, your default editor anyway — so you can make changes in the specfile if needed.

Note that you don't need to run rpmrebuild as root (unless some of the files are only readable by root), but you will need to specify a directory for the new RPM to be written to if you choose to run it as a regular user. Otherwise, it will fail when it tries to write the RPM to your default location. If you're not sure what the default location is, don't worry. If rpmrebuild runs successfully, it will print out the location of the RPM it has written. For example, for Red Hat 9 it writes RPMs to the /usr/src/redhat/RPMS/i386 directory. To specify the directory rather than writing to the default, use the "-d" option. So, if you want to write to the tmp directory, you'd use rpmrebuild -d /tmp packagename.

This is an excellent tool if you want to create an RPM after you've modified a program a bit (if you've made changes to a configuration file, or maybe edited a script or something). If you've made changes to files, it will automatically ask whether you want to continue and whether you'd like to change the release number. If you just want rpmrebuild to do its thing, you can use the "-b" (batch) option and it will proceed with rebuilding the package without prompting you. It will still print a warning to standard out letting you know that the package has changed.

Comment