Home » Linux » Applications » Create Deb Or Rpm From Targz With Checkinstall

Create .deb or .rpm from .tar.gz with checkinstall

tar logoCheckinstall is extremely useful utility to create .deb packages for Debian, Ubuntu (or .rpm packages for Fedora, RedHat, CentOs) from .tar.gz (or .tgz) source tarball after it’s compiled at your Linux box. In other words you can prepare binary package for later usage without need to compile software from sources every time you need to get it installed on certain Linux box.

Another application of checkinstall is software deinstallation that was compiled and installed from sources. As you might already noticed, not every programmer adds “uninstall” rule to Makefile and thus command “make uninstall” would fail. The nice solution is to use checkinstall to prepare binary package from sources and then install or uninstall it with dpkg command (or rpm in RedHat based distributions).

Here is the short algorithm on how to prepare .deb package from clamav source tarball:

1. Install checkinstall:
sudo aptitude -y install checkinstall (Ubuntu, Debian and related distributions)
or
sudo yum install -y checkinstall
(for rpm based distributions, please note that checkinstall usually isn't included to standard Fedora/RedHat repositories, so you will need to link up third party repo like DAG)
or
compile checkinstall from sources

2. Get clamav sources:
wget (as an example)

3. Install libraries that might be necessary for clamav compilation:
sudo aptitude install libgmp3 libgmp3-dev
(this command is applicable for Debian and certainly will be different for Fedora or RedHat)

4. Compile clamav:
tar xvfz clamav-0.81.tar.gz
cd clamav-0.81/
./configure --sysconfdir=/etc
make

5. Run checkinstall and follow its intuitive instructions (enter package description etc.):
sudo checkinstall -D make install

6. When finished you'll get clamav-0.81_0.81-1_i386.deb (or rpm package if you use Fedora/RedHat/CentOs) you may want to install with sudo dpkg -i clamav-0.81_0.81-1_i386.deb (or sudo rpm -i ...) or move to another PC for later installation.

SHARE:
Photo of author
Author
My name is Stefan, I'm the admin of LinuxScrew. I am a full-time Linux/Unix sysadmin, a hobby Python programmer, and a part-time blogger. I post useful guides, tips, and tutorials on common Linux and Programming issues. Feel free to reach out in the comment section.

4 thoughts on “Create .deb or .rpm from .tar.gz with checkinstall”

  1. I’m a fresh user of linux and using Debian

    This is one of the first packegs i try to install

    I’ve tryied putting this command in the terminal as a SU:

    ‘aptitude -y install checkinstall’

    Cant find package named ‘checkinstall’ in aptitude..

    Am i doing somthing wrong?

    Thx!

    Reply
  2. Hy,

    checkinstall seems to be a very good idea to simplify the installation step before doing some test on a application !
    Could it simplify the packaging task for developpers ?
    Does it handle dependencies rules automatically ? I mean does it includes in the package description the libraries or packages versions needed to run the software ?

    Kindest Regards,
    Laurent

    Reply

Leave a Comment