I just want to create an RPM file to distribute my Linux binary "foobar", with only a couple of dependencies. It has a config file, /etc/foobar.conf and should be installed in /usr/bin/foobar.
Unfortunately the documentation for RPM is 27 chapters long and I really don't have a day to sit down and read this, because I am also busy making .deb and EXE installers for other platforms.
What is the absolute minimum I have to do to create an RPM? Assume the foobar binary and foobar.conf are in the current working directory.
If you are familiar with Maven there also
rpm-maven-plugin
which simplifies making RPMs: you have to write onlypom.xml
which will be then used to build RPM. RPM build environment is created implicitly by the plugin.I often do binary rpm per packaging proprietary apps - also moster as websphere - on linux. So my experience could be useful also a you, besides that it would better to do a TRUE RPM if you can. But i digress.
So the a basic step for packaging your (binary) program is as follow - in which i suppose the program is toybinprog with version 1.0, have a conf to be installed in /etc/toybinprog/toybinprog.conf and have a bin to be installed in /usr/bin called tobinprog :
1. create your rpm build env for RPM < 4.6,4.7
2. create the tarball of your project
3. Copy to the sources dir
4. build the source and the binary rpm
And that's all.
Hope this help
As an application distributor, fpm sounds perfect for your needs. There is an example here which shows how to package an app from source. FPM can produce both deb files and RPM files.
For quick RPM building, check out Togo:
https://github.com/genereese/togo-rpm
The project has a Quick-Start guide and I was able to create a basic RPM in less than 3 minutes.
Example using the data provided in the original question:
1) Create the project directory using the script:
2) Make your desired directory structure under ./root and copy your files into it:
3) Exclude system-owned directories from your RPM's ownership:
4) (OPTIONAL) Modify the generated spec to change your package description/dependencies/version/whatever, etc.:
5) Build the RPM:
-and your RPM is spit out into the ./rpms directory.
Process of generating RPM from source file:
Similarly, I needed to create an rpm with just a few files. Since these files were source controlled, and because it seemed silly, I didn't want to go through taring them up just to have rpm untar them. I came up with the following:
Set up your environment:
mkdir -p ~/rpm/{BUILD,RPMS}
echo '%_topdir %(echo "$HOME")/rpm' > ~/.rpmmacros
Create your spec file, foobar.spec, with the following contents:
Build your rpm:
rpmbuild -bb foobar.spec
There's a little hackery there specifying the 'source' as your current directory, but it seemed far more elegant then the alternative, which was to, in my case, write a separate script to create a tarball, etc, etc.
Note: In my particular situation, my files were arranged in folders according to where they needed to go, like this:
and so the prep section became:
Which is a little cleaner.
Also, I happen to be on a RHEL5.6 with rpm versions 4.4.2.3, so your mileage may vary.