SoftwareInstallScheme
To have complete control over what versions of the software is being used, I use the following scheme for installing software. All software is installed independent from the Linux distribution, This:
- allows installation of newer versions without interfering with other
software on the system,
- will prevent any problems occuring from any automatic updates of the Linux distribution and
- allows easy rollback to a previous version
All software is installed in a single directory we'll call /topdir in this page. This directory is structured as follows:
/topdir/build: directory for unpacking and building the software packages
/topdir/pkgs: installation directory of the packages
Installing
So to build a software package:
- Download it to /topdir/build
- Unpack it
- Install it under its full name, version number included using e.g. the --prefix flag:
./configure --prefix=/topdir/pkgs/wxWidgets-2.8.1.1 python setup.py install --prefix=/topdir/pkgs/m2crypto-0.17
See below for details on Python installs.
- In /topdir/pkgs, create a symbolic link to the version of the package would want to use:
ln -s wxWidgets-2.8.1.1 wxWidgets
You can then refer to the software directly (e.g. /topdir/pkgs/wxWidgets/bin/wx-config) A problem (and benefit) of this approach is that not all binaries are in the same directory (cf. /usr), and you cannot set $PATH to a single dir. Hence, there should be a directory /topdir/pkgs/bin that contains links to the relevant binaries. E.g.
ln -s /topdir/pkgs/wxWidgets/bin/wx-config /topdir/pkgs/bin/wx-config
In cases where a package depends on other packages (i.e., libraries) it may be necessary to set $LD_LIBRARY_PATH to point the right version (and not the Linux distro one). Therefore, /topdir/pkgs/bin may also contain scripts that indirectly access the software. For example, Python depends on the wxWidgets library, so we would create a script /topdir/pkgs/bin/python:
#!/bin/sh PYTHONPATH=/prod/pkgs/m2crypto/lib/python2.4/site-packages:"$PYTHONPATH" PYTHONPATH=/prod/pkgs/wxPython/lib/python2.4/site-packages/wx-2.8-gtk2-unicode:"$PYTHONPATH" LD_LIBRARY_PATH=/prod/pkgs/openssl/lib:"$LD_LIBRARY_PATH" LD_LIBRARY_PATH=/prod/pkgs/wxWidgets/lib:"$LD_LIBRARY_PATH" export LD_LIBRARY_PATH export PYTHONPATH /prod/pkgs/Python/bin/python "$@"
Python packages
I consider Python packages as separate software packages. So they are also installed in their own directory in /topdir/pkgs (e.g. /topdir/pkgs/m2crypto-0.17), rather than in the Python installation. To make sure Python finds them, we have to set $PYTHONPATH in the script, as in the example. Note that to make sure you're using the right version of Python when installing, you must install Python packages as follows:
/topdir/pkgs/bin/python setup.py build /topdir/pkgs/bin/python setup.py build_ext /topdir/pkgs/bin/python setup.py install --prefix=/topdir/pkgs/m2crypto-0.17
And also for them, create a symbolic link:
ln -s /topdir/pkgs/m2crypto-0.17 /topdir/pkgs/m2crypto
Upgrading and Reverting
To upgrade a package, simply install it via the above procedure. Then, carefully, taking into account running processes, replace the symbolic link to the new version:
ln -sf /topdir/pkgs/m2crypto-0.18 /topdir/pkgs/m2crypto
To revert, just change back the symbolic link to the old version (if the software allows this, e.g. upgraded data formats, etc.)
