How to quickly create a RPM package in CentOS 6.5

Imagine that you want the latest build from your favorite program and you wan’t to keep an installation package whenever you need to revert your virtual machine.

In order to create a RPM package out of a built source you will need checkinstall. This is the easiest and quickest way to create and RPM package. This will keep you from having to compile it everytime you want to use it.

Install rpm handlers:

[root@yourvm home]# yum install -y rpm-build rpmdevtools

After this you will need to create the RPM Source trees

[root@yourvm home]# rpmdev-setuptree

After this step download checkinstall and install it.

[root@yourvm home]# wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/ikoinoba/CentOS_CentOS-6/x86_64/checkinstall-1.6.2-3.el6.1.x86_64.rpm
[root@yourvm home]# rpm -i checkinstall-1.6.2-3.el6.1.x86_64.rpm
warning: checkinstall-1.6.2-3.el6.1.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID f3dbb1a7: NOKEY

After installing checkinstall just run it inside your built tree.

[root@yourvm built_source_tree]# checkinstall --install=no
...
**********************************************************************

 Done. The new package has been installed and saved to

 /root/rpmbuild/RPMS/x86_64/asterisk-1.8.25.0-1.x86_64.rpm
 You can install it in your system anytime using:

      rpm -i asterisk-1.8.25.0-1

**********************************************************************

Leave a comment