This is a short guide to upgrading software.
Before You Upgrade
In order to make it easy to upgrade software, it's important to maintain an organized directory structure. I recommend the following:
- Keep all of your installed programs in a common folder - I use
- Keep all versions of a given program in a common directory - for example, all versions of Apache should be kept in
- Inside the common program directory, have each version installed to its own directory; e.g.:
$ ls ~/pkg/apache 1.0 1.1 1.2 1.3 1.4 2.0 2.1 2.2 2.3 2.4 2.5 2.6 std
- Finally, make a symbolic link to the "default" version (I call this
std, for the "standard version")
Sharing Information Among Versions
If you want to share information across all versions of a program, there are some subtleties you will have to think about before you install your program. For example, you may want all versions of Apache to use a common configuration file, or a common web directory. Normally, each version creates its own web directory and configuration files. However, when configuring your program, you can set configure options to hard-code the location of the configure files. For example, for Apache:
# Example Apache configure line ./configure \ --prefix=$HOME/pkg/apache/2.2.17 \ --sysconfdir=$HOME/pkg/apache/conf
Other programs, such as PHP, also have the same configure option:
# Example PHP configure line ./configure \ --prefix=$HOME/pkg/php/5.3.5 \ --sysconfdir=$HOME/pkg/php/conf
To find the appropriate option, you can run
./configure --help, which will print all configure options.
Once you have the above directory structure, upgrading is simple.
First, download and (if necessary) untar the source code.
Next, run configure, using the appropriate options (see above) so that the build will use the right configuration files, etc. Set the prefix to be the appropriate version number in the appropriate program directory.
Run make, make install, etc.
Test the new version of the program to ensure that it works properly. Once you are convinced it is working as expected, you can replace the "standard version" soft link (
std) to point to the latest version.
The nicest part about this system is, you don't even have to update your
$PATH (unless you're installing a brand-new program). You can set your
$PATH variable to point to the standard version, so that when you upgrade to a new version, and replace the "standard version" soft link, the new version will automatically be on your path.
GNU/Linux/Unixthe concrete that makes the foundations of the internet.
Command Line Utilities
Flags · Template:UnixFlag · e