I'm compiling and installing software myself on Linux (Debian Squeeze in my case). Downloading, unpacking, installing dependent developer libraries/headers, running configure then make.
Up to this point everything remains still in the source directory. Once I run make install
, basically I start having non-package files lying around in /usr/local
or /usr
(depends on --path
switch).
I also tried installing it into a different place, e.g. /opt
, but this often causes troubles somewhere. I.e. I've always to remember to specifically add this to the header/linker path. Or I install a package there and the system wide pkg-config
doesn't know about it (I'd again need to add extra flags). And even if I wold install every custom software in /opt
, I wouldn't know which all of those files in bin/
, etc lib/
etc. belong to each other. If I start installing them to /opt/software1/
, the maintenance problem just multiplies and I've to keep track of even more paths I'd need to add for compiling further packages or need to have them in the LD library path, etc.
But when I install software directly within /usr
I just get a bad feeling, no longer being able to properly tell which of my custom installation files belong where. It's easy to determine if a given file belongs to a package, but if it doesn't, on large custom installation, it's a pain to remember or figure out where a file belongs to.
It gets worse when I want to remove files. They're scattered in bin/
, lib/
, man/
, etc. So if I want to remove a custom installed package completely, I've to perform manual work or worst case, I'm no longer able to determine all of them and I'll leave stale files around.
I know I could also start building a custom package out of it. But that would require me analyzing every software I install upfront? I've no real experience with creating .deb
files and I also do not plan to distribute them to other installations. All I want is a nice way to keep track of custom local installations.
I probably could come up with something on my own, i.e. making a list of all files (find / ...
), installing software and then do this again and save the diff somewhere. Just wonder if there might be a better way.
Since you asked for best practices: The best one is to don't install software not in the repositories. If that's not possible, the best practice is to build packages out of it and use the systems package manager to manage them.
You will need to come up with a way to check for important updates, but how you do that is up to you. But if they are there, you need to build again and update from the new packages.
Have you tried checkinstall (it's in the Debian repos)?
Instead of using
make install
you can usecheckinstall
and it will create (and install) a package with the software so that you can track it using your package manager.I dunno whether you'll find this helpful at last, but I'll share it at least: «… The NetBSD Packages Collection (pkgsrc) is a framework for building third-party software on NetBSD and other UNIX-like systems …»