Sunday, January 23, 2011

Linux noob question - How do I update a program built from source?

When I build a program from source (CentOS), How do I go about updating it to a new version? Can I just run the make && make install again with the same configure options?

  • When you get the new source, check the README or INSTALL files. Often there will be a section about upgrading. If there is not, doing a make && make install should work.

    From kbyrd
  • 99% of time, just download the source of the new version (or a patch), build and install.

    From MrShunz
  • This is where GNU Stow can be useful. I've been using this tool for years to keep my OS clean. This is a package manager for programs installed from source. Here's how it works. First, I have one single directory where I keep all such programs, /usr/local/stow. Inside it, there are directories for each program. When I compile programs from source, I use option --prefix=/usr/local/stow/program-name. When make install is done, the executable files are installed under /usr/local/stow/program-name/bin, libraries are found in /usr/local/stow/program-name/lib, etc. Then I run cd /usr/local/stow and sudo stow program-name. The last command creates links from /usr/local/stow/program-name/bin to /usr/local/bin/, from lib to /usr/local/lib, etc. So, all files that belong to one program are located in one directory.

    When I want to delete or update the program, I run sudo stow -D program-name to delete the links and remove the directory. Now, the system is clean and I can install the new version.

    From minaev

0 comments:

Post a Comment