How do I put GNOME someplace special, like /opt/gnome?

Many people like to put GNOME off by itself, in its own directory. Doing this makes it easier to uninstall in an emergency, easier to control who has access to GNOME, it lets you export the gnome directory to other systems, and so on. To do this requires a little bit of preparation. I'll walk through the steps on a system that uses ld.so, where all users are to have access to GNOME. I'll be putting GNOME in the /opt/gnome directory. Just replace /opt/gnome with whatever other directory you want.

The biggest issue are making sure the system can find the GNOME binaries in /opt/gnome/bin, the libraries in /opt/gnome/lib, and the man files in /opt/gnome/man. First, create those directories. Then, add a line to /etc/ld.so.conf saying /opt/gnome/lib, and then run ldconfig. Next, insert a line into /etc/profile, saying export PATH="$PATH:/opt/gnome/bin". Lastly, insert a line into /etc/man.config, saying MANPATH /opt/gnome/man.

The other issue is there are a couple of directories which GNOME will put things in, which would be better put elsewhere. The easiest way of doing this is with symbolic links. Type the following:

$ mkdir /opt/gnome/share
$ cd /opt/gnome/share
$ ln -s /usr/share/locale locale
$ ln -s /usr/share/aclocal aclocal

Now you're all set to use /opt/gnome as a prefix when compiling. To do this, just give the ./configure command the option --prefix=/opt/gnome. Of course, if you want someplace special other than /opt/gnome, just replace it with the directory you do want in all the instances above.