• After installing a package/library from a Makefile, do you keep the Makefile, which contains uninstall target somewhere, for later uninstallation if any?
    • If yes: Do you store it at some "standard" directory, like /usr/local?
    • If no: How do you uninstall then?
  • You could, if it has a make uninstall target. Not all software does. If possible, use a binary package. Then uninstallation is not an issue. In generally keep all software sources in /usr/local/src/pkgname. I think it's a reasonable location. – Faheem Mitha Jul 9 '14 at 19:33
  • 1
    You can use stow to manage each application stored in a separate location. It then sym-links them all into a common location. – ctrl-alt-delor Jul 9 '14 at 21:33
  • @richard, that's exactly what I was going to recommend. You should make it an answer. – Alan Shutko Jul 10 '14 at 0:12

Like goldilocks, I keep the installation files around in a folder designated src -- in my case sometimes it's /usr/local/src, but often it's /opt/src. I take it a step further -- I use 'script' to record a typescript all the way through the process, and I rename those typescript files to help me remember what they were for later. I keep them in the same folder as the source. Then, when I'm satisfied that the build and installation were good, I wrap the whole thing up into a compressed tarball and keep it basically forever under /opt/src.

I do this because invariably if something is useful enough to install from source and keep around for a year, I'm going to need to repeat the process again in order to get bugfixes and security updates from upstream. When that time comes, I want to go back to one spot, unpack the original file, and quickly remember exactly what I did the last time, along with what the resulting output was.

You can even take this further -- remember, the goal should be to make it as easy as possible for you or the person who comes after you to reliably upgrade the software in the future, so every clue you can leave your future-self is good, and the less you do this the more likely you are to end up frustrated and burning time later.

Here are other suggestions for clues to leave your future self and ways to avoid problems:

  1. Use 'script' to record installations and their output; then rename the resulting typescript files so that you don't accidentally overwrite them later. Keep them in the build folder.
  2. Collect before-and-after info and keep it in the build directory. For example, you can do "ls -lR / >before.ls-lr; ...install software...; ls -lR / >after.ls-lr". Most package management tools also have a verify option which will dump out all kinds of detail about your system -- having a before-and-after of this is helpful. Sometimes it's also worth doing a full md5sum of all files or using a tool like tripwire or aide.
  3. Be suspicious of the installer -- are you sure it doesn't change permissions to mode 777 on /var or do something similarly nefarious? Comparing the before and after output of a recursive file listing with a tool like vimdiff can help you spot problems before you forget how to fix them.
  4. If you need to leave yourself notes, put them in the build directory -- e.g. a file like "README.bob" would go a long way towards helping "Bob" with any little gotchas you detect the first time through that you might forget next time.

All this effort pays off once you start distributing the software to a bunch of systems, or in an environment where you really care about the system/data.

You can take things a step further and use any of hundreds of package managers to build a package that you can distribute to your own systems. With a tool like FPM, that's easy.

| improve this answer | |

I wouldn't store just the makefile. While the uninstall target may not (or perhap, should not) need anything else to succeed, that's not a guarantee.

So that means keeping a copy of the original package. There's not much point, though, if there's a public archive of old versions and you aren't worried about it going away. You can just download it again later anyway. The only issue with this is that for autotooled stuff you need to run ./configure first, and if you use different options uninstall may miss something -- but that's not such a big worry, I think. Occasionally I've kept notes about the particular configuration of something.

I keep independent source packages in /usr/local/src, but it as long as you can find it when you need it, it doesn't matter.

| improve this answer | |
  • "I keep independent source packages in /usr/local/src", (1) are the files you keep there exactly all the files you download? (2)does make install often not copy the files to ` /usr/local/src? and do you do the copy manually by cp`? – Tim Jul 9 '14 at 19:45
  • Unless there's some special reason not to, I delete the build directory (I've added a line or two regarding autotools configured stuff in this regard), but I leave a copy of the tarball around. Many of the things I install from source I keep upgraded, so I'm concerned about stuff being cleanly replaced, which ideally starts with an uninstall of the old version. Then I might still keep the old tarball (i.e., so two versions), but if it's something reasonably established (of which I know I can download a copy of any version at any point) I wouldn't bother. – goldilocks Jul 9 '14 at 19:56
  • Does make not copy to /usr/local/src? -> No, not that I've ever observed. Do you do the copy manually by cp? -> that or a file browser. – goldilocks Jul 9 '14 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.