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

Welcome to Linux Screw! If you're new here, you may want to subscribe our RSS feed.

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 http://mesh.dl.sourceforge.net/sourceforge/clamav/clamav-0.81.tar.gz (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.

 
 
» You might also be interested in the following articles:
Make linux shell scripts encrypted
Create Linux user with password
How to create custom linux ISO image?
Keep ssh session saved (Unix “screen” utility)
Fully automated Fedora Linux installation manual (create custom installation cd)



» Want to stay up to date? Subscribe to our E-MAIL or RSS feed!

9 Responses to “Create .deb or .rpm from .tar.gz with checkinstall”


  1. 1 dicky

    good

  2. 2 hemanth

    ========================= Installation results ===========================
    make: *** No rule to make target `install’. Stop.

    **** Installation failed. Aborting package creation.

    Cleaning up…OK

    Bye.

    This is what i got when i tried creating a deb file for this

    http://nsl10.csie.nctu.edu.tw/products/nctuns/download/download.php

    Please mail me if u find a solution

    mailto:hemanth.hm@gmail.com

  3. 3 hemanth

    ./configure –sysconfdir=/etc
    bash: ./configure: No such file or directory

    forgot to mention that

  4. 4 Kfir

    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!

  5. 5 Sanjaya

    Hi Kfir and Hemant,

    If you still need help on that, I was having the same problem as yours.

    I am following a tutorial from falkotimme.com (can’t find the link but I have the file saved):

    ===========
    Creating .deb-Packages With Checkinstall

    Version 1.0
    Author: Falko Timme
    Last edited 02/04/2005

    Checkinstall is a nice tool to create simple .deb-packages that you can use in your local network (e.g. if you have to install the same piece of software on multiple computers running Debian). It lets you compile and install software from the sources like before, but with the difference that you end up with a simple Debian package which also means that you can easily uninstall the software you just compiled by running dpkg -r!

    I will demonstrate the use of checkinstall by compiling and installing the anti-virus software ClamAV on a Debian system.

    This howto is meant as a practical guide; it does not cover the theoretical backgrounds. They are treated in a lot of other documents in the web.

    This document comes without warranty of any kind!

    1 Install Checkinstall

    It is as easy as 1-2-3:

    apt-get install checkinstall

    If your system tells you that it does not know a package called checkinstall then add the following line to /etc/apt/sources.list:

    deb http://www.backports.org/debian/ woody checkinstall

    and run

    apt-get update

    Then try again to install checkinstall.

    2 Install ClamAV

    We need the ClamAV sources . We will install the software from the /tmp directory.

    cd /tmp
    wget http://mesh.dl.sourceforge.net/sourceforge/clamav/clamav-0.81.tar.gz
    apt-get install libgmp3 libgmp3-dev
    groupadd clamav
    useradd -g clamav -s /bin/false -c “Clam AntiVirus” clamav
    tar xvfz clamav-0.81.tar.gz
    cd clamav-0.81/
    ./configure –sysconfdir=/etc

    (Please note: ./configure –help gives a list of all configuration options available.)

    make

    Now comes the main difference: instead of make install we run

    checkinstall -D make install

    Answer the question “The package documentation directory ./doc-pak does not exist.
    Should I create a default set of package docs? [y]:” with y.

    Then enter a description for your package (e.g. ClamAV 0.81). A summary of the configuration options for your .deb-package will come up:

    You can change them here or just hit enter to continue. Now ClamAV will be installed plus a Debian package will be created which you can find in the installation directory /tmp/clamav-0.81 as the final checkinstall summary states:

    Now you can copy clamav-0.81_0.81-1_i386.deb to other Debian computers and run

    dpkg -i /path/to/clamav-0.81_0.81-1_i386.deb

    to install it. If you want to remove it, just run

    dpkg -r clamav-0.81

    This even works on the computer you compiled ClamAV on! This is a nice way to install software from the sources and remove it if you are unsatisfied with the result.

  6. 6 jeroen

    Thanks to this tutorial, I’ve made another that explains how to make a .deb file for Stellarium 0.10.0
    I’ve tested it on A linux Mint machine.

    Jeroen

    http://ubuntu-install.blogspot.com/2009/02/how-to-create-deb-file-for-stellarium.html

  7. 7 eleandar

    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

  8. 8 WARLOCK

    ????????? ?? ?? ??? ??????????, ?????? ?????????????? ??????????? ???????. ;)

  1. 1 Checkinstall for linux newbies « SGLNX

Leave a Reply




Friendly Sites:Who is behind Linux Screw?
Aspiring Sysadmin | GeekyBits³ | Bash Cures Cancer | TOTMS
Linux Operating System | Small Linux Deployments | My SysAd Blog
The Danesh Project | ZEPY | Linux config Wiki | Planet Sysadmin
The Sys Admin | {buhay sysad} | a non-geek's linux notes
Linux HOWTOs, Tutorials & Projects with Adam Palmer | LinuxAlt.Com
My name is Artem Nosulchik (artiomix AT gmail DOT com) and I'm Linux/Unix, Cisco systems engineer. The main idea of Linux Screw is to share relevant knowledge, skills and observations over The Web. Here you can find a lot of information related to different Linux distributions, FreeBSD, IOS as well as a other Open Source around staff. Read more ››