Build a Debian package from source using checkinstall
Debian's stable release does not have old packages, they're ... umm, better said to be seasoned packages?
Older versions of software, yes, but they receive a stream of bugfixes and security patches courtesy of the hard work of Debian maintainers and the project's security team. Still. Sometimes its desirable to have the latest version of an application, but continue to stick with stable.
htop, an interactive process viewer. Newer releases can output information about
Disk IO and
Network not available in the Debian
There are a few alternative methods available to obtain new software. First, and easiest, method is to see if the new software has already been packaged for Debian in the backports repository. Add this repository to
sources.list, and its just a matter of
apt install -t bullseye-backports <package> to obtain the desired package.
However, in the case of
htop, there are no newer pre-packaged releases available in backports. Therefore, I elect to download the
htop source and create my own custom Debian package using the simple and straightforward packaging utility checkinstall.
Instead of the usual ...
./configure make sudo make install
... its ...
./configure make sudo checkinstall
Default is to run
checkinstall interactively, set a few parameters, whereupon the program creates a
*.deb package in the build directory, then installs the package (unless run with
--install=no) to the system. It can then be managed in the usual way with Debian's package tools though, as its a custom package, any updates are on me. Bonus: the
*.deb can be installed on other similar systems.
I will use
htop as an example build-and-install. There were a few bumps to take care of before everything finally worked out OK.
1. Get started by installing ...
$ sudo apt install build-essential autoconf automake libtool checkinstall
htop is already installed, remove ...
$ sudo apt purge htop
3. Download and unpack the latest
htop stable release from https://github.com/htop-dev/htop/releases.
4. Navigate into the unpacked directory, containing a
configure.ac file. Run ...
... which generates a
5. Run ...
... which - in the particular case of
htop - generates an error ...
configure: error: cannot find install-sh, install.sh, or shtool in build-aux "."/build-aux
Fix this by updating the generated config files using
$ autoreconf -i configure.ac:61: installing 'build-aux/compile' configure.ac:15: installing 'build-aux/config.guess' configure.ac:15: installing 'build-aux/config.sub' configure.ac:16: installing 'build-aux/install-sh' configure.ac:16: installing 'build-aux/missing' Makefile.am: installing './INSTALL' Makefile.am: installing 'build-aux/depcomp'
6. Run ...
$ ./configure $ make $ sudo checkinstall
A package -
htop_VERSION_amd64.deb - is created in the directory, and also installed to
$ apt-cache policy htop htop: Installed: 3.1.1-1 Candidate: 3.1.1-1 Version table: *** 3.1.1-1 100 100 /var/lib/dpkg/status 3.0.5-7 500 500 http://deb.debian.org/debian bullseye/main amd64 Packages
7. View ...
» Later: #100DaysOfCode
« Earlier: Roll your own Linux desktop using Openbox