Using stow for simple package management

stow

I have recently been introduced to a useful utility called stow. stow has been around for a long time and provides a simple way to manage compiled code.

This is the way I have used stow: Create an unused directory tree. (I used /opt/local/PACKAGES). When using configure use --prefix=/opt/local/PACKAGES/package-1.2.3 where package-1.2.3 is the name of the package you are compiling e.g.openssl-0.9.7d.

When you have run make and make install then cd to /opt/local/PACKAGES/ and call stow package-1.2.3. This creates a set of symbolic links two directories up, thus binaries in /opt/local/PACKAGES/package-1.2.3/bin are seen in /opt/local/bin.

From man stow

     The approach used by Stow is to install  each  package  into
     its  own  tree, then use symbolic links to make it appear as
     though the files are installed in the common tree.  Adminis-
     tration  can  be  performed in the package's private tree in
     isolation from clutter from other packages.  Stow  can  then
     be  used to update the symbolic links. The structure of each
     private tree should reflect the  desired  structure  in  the
     common  tree;  i.e.  (in the typical case) there should be a
     bin directory containing executables, a  man/man1  directory
     containing section 1 man pages, and so on.

If all references to the package are made via the symbolic links, when it comes to updating a package you can simply make install the new package to e.g. /opt/local/PACKAGES/package-2.2.4.

[root@ldap]# stow -D package-1.2.3
[root@ldap]# stow package-2.2.4

If you find there is a problem with the new install you can easily revert back to the original

[root@ldap]# stow -D package-2.2.4
[root@ldap]# stow package-1.2.3


Author: Lance Rathbone
Last modified: Wednesday June 18, 2008

Home