Never change system files
On most UNIX-like operating system all the standard binaries are install in /bin, /usr/bin, /sbin and /usr/sbin. There are some additional compatibility directories (at least on Solaris) but most of the essential binaries are to be found in those directories. If you download any kind of open source software (that doesn’t have a binary package for your preferred platform) and run their standard ./configure script they usually want to install themselves into /usr. Do yourself a favor and never allow it.
The same goes for /usr/local. It is used by so many binary packages today so it is best to stay away from that hierarchy as well.
If you allow those random programs to install into the system directories you are entering a world of unlimited pain. When you download patches they refuse to work since the binary is not the original one. When you reinstall the system or move a program to another server you will forget some of those binaries that has been placed in the system directories.
A better alternative is to create your own directory structure, I always create /opt/software. There you can find bin, sbin, man and all the other directories you expect to find. In most cases it is just a matter of giving the right prefix to the software when you configure it. Something like this:
$ ./configure --prefix=/opt/software
$ make
$ make install
In addition you should make sure /opt/software is owned by you (or some other non-root user). When you do the “make install” as the non-root user it is impossible for the software to install over your system files (in case the install script is buggy, not really unheard of in the open source world.
You now know where all your extra software is installed and if you need to do backups or move it to another machine it becomes a very simple operation.
Sometimes software is so buggy that it really requires something to exist in /usr/bin. In that case it is better to leave a symlink there and point it into the /opt/software hierarchy.
This can be extended to your own simple packaging system but I will leave that for a later post. If you follow this advice you will already be much better off already.
Do you need system administration assistance? If you like what you are reading please consider subscribing to the RSS feed. If you have feedback or if you find the article useful please leave a comment below.

