Whenever you compile your own packages and want to install them in the /usr/local tree, you need stow
sudo apt-get install stowThis will create the directory /usr/local/stow under which you will install your self-compiled programs, each in its own directory. Running stow on such a directory, will install some links in the ordinary /usr/local directories.
As an example, suppose we have compiled foo-0.98.4.1 and want to install it. Running
make -n installreveals that it want to put the produced files in /usr/local/bin etc. However by issuing the command
sudo make install prefix=/usr/local/stow/foo-0.98.4.1will result in all the installed files under the given directory.
Now issuing
cd /usr/local/stowwill create the appropriate links e.g.
sudo stow foo-0.98.4.1
/usr/local/bin/foo -> /usr/local/stow/foo-0.98.4.1/bin/foo
and the program can be used as if it was installed natively in /usr/local but can now be easily de-installed by running
cd /usr/local/stowwhich removes the create links. Another version of the same program can be installed next to it and by using stow you can decide which version you use.
sudo stow -D foo-0.98.4.1
When a lot of packages are installed in stow you might want to know which packages are stowed, for this we created the following command
find . -wholename './stow' -prune -o \
-type l -exec readlink -f {} \; | \
sed -e 's/^.*stow\/\([^/]*\)\/.*$/\1/' | \
sort | uniq
No comments:
Post a Comment