Posted by Steve on Fri 27 May 2005 at 16:23
The majority of applicatications you'll wish to use upon your system are already available as Debian packages, or as backports if you're running Woody. But there may be a few applications you need to install from source. Rather than fully Debianising the package yourself you can integrate it into your system with checkinstall.
checkinstall is a simple program which monitors the installation of files, and creates a Debian package from them.
There are two primary benefits to using checkinstall instead of running make install:
It's also a good way to install arbitary files to a Debian system, such as configuration files - you merely need to create a Makefile which will install packages, without needing to create a full Debian package.
(Although it should be noted that building Debian packages of perl modules, and rebuilding Debian packages are both relatively straightforward jobs).
To get started with checkinstall you will need to install it. As root run:
apt-get install checkinstall
Once it is installed you can use it the next time you need to install a package from source code.
As an example of using it we'll investigate using it with the package htpd which is a software tool for synchronising your clock against time responses received from HTTP servers. (Note that we've covered keeping your clock current previously).
At the time of writing this software is not available as a Debian package, so it is a perfect example to start with.
First of all we need to download the source code and unpack it:
skx@lappy:~$ mkdir tmp skx@lappy:~$ cd tmp skx@lappy:~/tmp$ wget http://www.clevervest.com/htp/archive/c/htpdate-0.8.0.tar.gz skx@lappy:~/tmp$ tar -zxf htpdate-0.8.0.tar.gz skx@lappy:~/tmp$ cd htpdate-0.8.0/ skx@lappy:~/tmp/htpdate-0.8.0$
Now we can build the software as we normally would. In this case, assuming you have a compiler installed, etc, then you can build the software by typing "make":
skx@lappy:~/tmp/htpdate-0.8.0$ make gcc -Wall -ansi -Os -o htpdate htpdate.c
This gives us the binary, normally we'd proceed to install the created binary by executing "make install". Instead we're going to use checkinstall to monitor the installation process, and create a Debian package for us.
As root run:
checkinstall -D make install
(The '-D' flag means "Build a Debian package").
This will ask you if you wish to create some documentation:
root@lappy:~/tmp/htpdate-0.8.0# checkinstall -D make install
checkinstall 1.5.3, Copyright 2001 Felipe Eduardo Sanchez Diaz Duran
This software is released under the GNU GPL.
The package documentation directory ./doc-pak does not exist.
Should I create a default set of package docs? [y]:
If you say "yes" then you will find the binary will have some documentation installed in /usr/share/doc/$packagename.
After that you'll be asked to give a description for the package:
Please write a description for the package. End your description with an empty line or EOF. >> HTTP Time Protocol
After that you'll see a summery :
This package will be built according to these values: 0 - Maintainer: [ root@localhost.localdomain ] 1 - Summary: [ HTTP Time Protocol ] 2 - Name: [ htpdate-0.8.0 ] 3 - Version: [ 0.8.0 ] 4 - Release: [ 1 ] 5 - License: [ GPL ] 6 - Group: [ checkinstall ] 7 - Architecture: [ i386 ] 8 - Source location: [ htpdate-0.8.0 ] 9 - Alternate source location: [ ] Enter a number to change any of them or press ENTER to continue:
I choose "0" to change the email address of the package maintainer to my own, then entered "enter" to continue.
Once this last step has been completed the package will be installed, and the binary .deb file produced:
**********************************************************************
Done. The new package has been installed and saved to
/home/skx/tmp/htpdate-0.8.0/htpdate-0.8.0_0.8.0-1_i386.deb
You can remove it from your system anytime using:
dpkg -r htpdate-0.8.0
**********************************************************************
We can see which files are included by examining the built .deb file:
root@lappy:~/htp/htpdate-0.8.0# dpkg --contents htpdate-0.8.0_0.8.0-1_i386.deb drwxr-xr-x root/root 0 2005-05-27 17:15:28 ./ drwxr-xr-x root/root 0 2005-05-27 17:13:43 ./bin/ -rwxr-xr-x root/root 9532 2005-05-27 17:13:43 ./bin/htpdate drwxr-xr-x root/root 0 2005-05-27 17:13:43 ./usr/ drwxr-xr-x root/root 0 2005-05-27 17:13:43 ./usr/local/ drwxr-xr-x root/root 0 2005-05-27 17:13:43 ./usr/local/share/ drwxr-xr-x root/root 0 2005-05-27 17:13:43 ./usr/local/share/man/ drwxr-xr-x root/root 0 2005-05-27 17:13:43 ./usr/local/share/man/man8/ -rw-r--r-- root/staff 1372 2005-05-27 17:13:43 ./usr/local/share/man/man8/htpdate.8.gz drwxr-xr-x root/root 0 2005-05-27 17:13:43 ./usr/share/ drwxr-xr-x root/root 0 2005-05-27 17:13:43 ./usr/share/doc/ drwxr-xr-x root/root 0 2005-05-27 17:13:43 ./usr/share/doc/htpdate-0.8.0/ -rw-r--r-- root/root 2835 2005-05-26 22:32:18 ./usr/share/doc/htpdate-0.8.0/CHANGES -rw-r--r-- root/root 1824 2005-05-26 22:32:18 ./usr/share/doc/htpdate-0.8.0/README
In this case the files beneath /usr/share/doc/htpdate-0.8.0/ are only included because we answered "yes" when asked if we wished to create the documentation directory - if we'd said "no" they would have been ignored.
Because the package has no notion of dependencies we could install it on any machine - depending upon your point of view this is either a bug, or a feature!
For more options please see the manpage:
man checkinstall
Exactly.
Although you'll notice as part of the build prcess the package is actually installed - so you'll not need to install it manually, unless you wish to install the package upon another machine.
Steve
-- Steve.org.uk
[ Parent ]
[ Parent ]
I've not tried it, but I expect you'd see a few problems.
First of all you'd need to make sure that you'd configured the software properly, with "--prefix=/", and "--sysconfdir=/etc/sshd", etc.
(If you didn't do that it wouldn't have the same defaults as the Debian packages).
But once the package was installed I suspect you'd get conflicts fairly quickly between your package and the official Debian package. (Unless you uninstalled that first, which would be the ideal solution - but once you did that you might find you had no access).
It's also worth thinking about the extra things that most Debian packages give you, such as init scripts to make the server run at bootup. If you installed the package from source you wouldn't have that. (Although you can cause things to be added to the packages you build with checkinstall, so you could fix this if you wished).
All in all I'd not recommend using checkinstall for such a critical package as openssh. Whilst it might work I'd be reluctent for fear of causing problems. I regard checkinstall as a neat and simple way of integrating non-critical software into a system, for which packages aren't available (yet).
Steve
-- Steve.org.uk
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
To be fair GNU Stow does have the attraction, as I understand it, of allowing multiple versions of an application to be installed at the same time.
With checkinstall building the package will automatically install it (unless you tell it not to) and then you lose the old version.
This might be a concern for some users - although I guess you could keep the old .deb file around if you wished to revert.
Steve
-- Steve.org.uk
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
Not as far as I'm aware.
However you might be able to get by with writing a very simple Makefile which just does a "cp" to move the files into the correct location.
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
so if i understood correctly, if i 'package' the program ABC in this manner, and then a new version of ABC becomes available, then i just repeat this compilation/packaging process for the new version, and then run to replace the previous version in the same manner, with the new package?
[ Parent ]