posted by Justin Piszcz on Mon 7th Jun 2004 05:37 UTC
IconExample: You have the Linux 2.4.26 kernel source. Fact: You want to install the newest 2.4.xx kernel. Problem: You have GCC-3.4.0 installed. Solution: Temporarily install GCC-3.3.3. Here's where relink comes in!

jpiszcz@p500:~$ cd /usr/src/linux-2.4.26
jpiszcz@p500:/usr/src/linux-2.4.26$ # needs gcc-3.3.3 or wont compile
jpiszcz@p500:/usr/src/linux-2.4.26$ gcc -v
Reading specs from /a/app/gcc-3.4.0/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: ./configure --prefix=/app/gcc-3.4.0
Thread model: posix
gcc version 3.4.0
jpiszcz@p500:/usr/src/linux-2.4.26$ mv /app/gcc-3.4.0 ~
jpiszcz@p500:/usr/src/linux-2.4.26$ relink
  2480 link(s) removed
jpiszcz@p500:/usr/src/linux-2.4.26$ mv /appc/gcc-3.3.3 /app
jpiszcz@p500:/usr/src/linux-2.4.26$ relink
  2200 link(s) installed
jpiszcz@p500:/usr/src/linux-2.4.26$ gcc -v
Reading specs from /vapp/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.3.3/specs
Configured with: ./configure --prefix=/app/gcc-3.3.3
Thread model: posix
gcc version 3.3.3
You can now compile Kernel 2.4.26.

If you are interested in the history, benefits and purpose of using this tool as well as how to set it up and use it, please continue on.

What is relink?

Relink is an undiscovered treasure when it comes to package management.

How so?

With traditional package management, programs are installed all over the system. For example installing a large application may put files in /usr/include, /usr/lib, /usr/bin, /usr/sbin and the like. Some people might say what about /usr/local? Yes, you can install programs into /usr/local, but then it's a mess, you do not know what versions of what you have installed! Then, you have to rely on package management tools to determine what versions of specific applications you have installed or you have to type the following ./program --version, but what if it is a library? Then you have to check the headers or look in the *.la files which might help in determining the version. With relink, all of your program are installed to the $prefix/program-name-1.0.

What is the intent of relink?

Summarized from the manpage: relink is a utility designed to assist users in managing packages with the normal application layout directory structure, such as: application/bin, application/etc, application/lib, application/man. It can be used to create a single directory path for tens to thousands of applications. In other words, you can have the latest and greatest applications in your $HOME/app, instead of waiting for your system administrator install them on the system for you!

The motivation for relink was inspired by two primary needs

1] The ability to organize and install software packages easily without root access.

2] The ability to build applications and interrelated libraries one time and then to share these between systems easily. Some applications may take hours to build and install due to dependencies and libraries required. relink allows you do this one time for multiple machines.

Relink is probably of most interest to those who constantly want to use the latest version of tools or applications or individuals that must support moving applications between many systems. If you are currently satisfied with your existing package management system, rpm, pkgadd, depot, etc., relink may not be of interest. However if you desire non root flexibility and understanding where every file is without searching relink may be of value.

Benefits of using relink

1] Full control of all of your packages.

2] Easy to backup.

3] Reduce risk of exploits (if relink user != root, which is recomended).

Explanation: Some source packages have become trojaned in the past and may be able to do further damage if the user running make install as root.

Backing up your applications

A nice thing to do is build all of your applications based upon other libraries and applications that exist in your /app directory structure.

Why is this?

Because then the applications become portable (as long as glibc) is the same version or greater on the other machine. The thing I like most about relink is the ease of use it provides when backing up all of my programs. With a traditional package management system, some people might say:

"But oh, you can keep the rpms,tgz,deb."

Well that may be true, however with relink you keep the entire directory structure and the preferences you have for each application!

Example: /app/openssh-3.8.1p1/etc/sshd_config

I can untar my a.tar on another machine and setup the paths and voila I have a complete working system again with all my applications and tools. Without relink, I would be forced to backup my /usr partition filled with all sorts of files intermingled with one another, which I might add is not very useful when attempting to restore one's system!

So how would I find the version of nmap that is installed using the following package management systems as shown below?

There are many package managers for Linux, some of the most popular include the following:

1] Debian Package [tool: dpkg]
   ex: program.deb

2] RedHat Package Manager [tool: rpm]
   ex: program.rpm

3] Slackware Package [tool: installpkg/removepkg/etc]
   ex: program.tgz

   For Debian: dpkg -l | grep nmap
   For RedHat: rpm -qa | grep nmap
For Slackware: ls -l /var/log/packages/nmap*
How would I find out which version of nmap was installed if I had used relink?
$ ls -ld /app/nmap-*
drwxr-xr-x  5 jpiszcz wheel 4.0K Jan 19 04:45 /app/nmap-3.50/
Why compile programs from source?

Example: Slackware 9.1 is my favorite distribution. However it has a serious flaw, I launch gaim and try to connect to MSN, then what happens? It says GAIM is not linked with the SSL libraries. Due to problems similar to this I decided to start compiling almost everything I run in late 1996 and control applications I install with relink.

Example: It has simplified my life and helped me organize the applications I install. It also makes backups very easy and I will discuss this in a moment.

Example: Distributions often lag behind when a new version of software is released, perhaps your distribution does not have a package for OpenSSL yet and you have to run an OpenSSH server for users, if you do not want to risk getting compromised by the latest exploit affecting up to OpenSSL 0.9.7c, then you need to upgrade. Using relink provides a flexible means of doing this.

Why not use Gentoo/Lunar/Onebase/ROCK/Sorcerer/SourceMage or other source based distribution?

One word, control. Using automated package management might be a good thing for some people, but I prefer to have complete control of my system and how I compile each individual application. I also have found no distribution that does what relink does by installing applications like the following example: /app/program-1.0/{bin,etc,man,lib,sbin}.

Why use relink?

In my opinion, it is the best package management tool I have ever used. I have been using it since 1996. It only requires Perl 5.6 on the target system to run. I have personally tested it on a wide array of Linux distributions and it has always worked no matter what distro I was using. It also has been tested on Solaris 2.6 - 2.9.

Opinion #1: What is wrong with dpkg? Not much, however you still do not have
            control over how your programs are created or what features they

Opinion #2: What is wrong with rpm? RPM is a complete nightmare as most of us
            know.  Below is an example:

            Say you want to install program.rpm.
            This is what often happens when you try to install an RPM.
            # rpm --install program.rpm
            program.rpm: depends on this.rpm that.rpm other.rpm
            # rpm --install this.rpm that.rpm other.rpm
            other.rpm: depends on this2.rpm that2.rpm more.rpm
            # rpm --install this.rpm this2.rpm that.rpm that2.rpm other.rpm more.rpm 
            # rpm --install program.rpm
            # program &
            program: error __symbol_xyz_not_found

            This also made me literally sick of RPM, desperately looking for
            another solution.

Opinion #3: What is wrong with tgz? Not much, however you still do not have
            control over how your programs are created or what features they
            contain.  In addition to that, there is no dependency checking,
            which is a blessing for advanced users but may cause problems
            for novice users.
Table of contents
  1. "Relink, Page 1/5"
  2. "Relink, Page 2/5"
  3. "Relink, Page 3/5"
  4. "Relink, Page 4/5"
  5. "Relink, Page 5/5"
e p (0)    27 Comment(s)

Technology White Papers

See More