7

Newbie linux admin question here. Over the last 6 months or so, I've ended up upgrading most of the default install software on my server setup on Fedora. Last few weeks or so, I've come to realize that there are many instances of the same software on this filesystem, and some are still being used and some not.

For example, I've upgraded/re-installed MySQL at least 3 times, once from rpm, and twice from source tarball. I've just realized that there's mysql binaries in /sbin, /usr/bin, /usr/local/bin, and /usr/local/mysql/bin. To make things worse, the which command points to /sbin, (thanks to the order ENV's PATH is written in, probably), but the init.d script uses /usr/local/bin, and all the shared libraries and headers are coming from yet another installation. It's a mess.

It's the similar situation with the current installation of PHP and Python.

My question is this - How do I clean this up? Do I:

  1. Pick one of the installations, point the proper PATHs to it, and delete the rest. Recompile all the dependencies that were pointing to the (now-deleted) other installations, if they fail because their dependency paths were written in.
  2. Level everything and start from scratch.

Is there another solution? Thanks for your advice!

Chopper3
  • 100,240
  • 9
  • 106
  • 238
  • http://serverfault.com/questions/24523/meaning-of-directories-on-unix-and-unix-like-systems – TRS-80 Jul 23 '09 at 02:37

2 Answers2

3

depends how much time and effort you wish to invest. A clean install is always best if you have the time and patience to rebuild everything. The quick solution is to modify your PATH to point to the versions you want. Another option is to create symlinks to point to the desired versions. Again the best method is a completely clean install

ennuikiller
  • 828
  • 8
  • 8
  • 1
    Every so often, say when I am buying a new machine, I do a clean install and migrate the data and configurations over. – pcapademic Jul 23 '09 at 04:08
1

The bad news is that there isn't a quick fix.

The good news is that MySQL isn't usually too messy as to where it installs itself. I'd advise you to clean them up by hand. Start by compiling a list of each installation. The following command should catch everything:

INSTALL_PATH="/"
find ${INSTALL_PATH}/{bin,sbin,share} -name 'mysql*' -type f
find ${INSTALL_PATH}/{lib,include,share} -name 'mysql' -type d

Repeat the process with INTSTALL_PATH as /usr and /usr/local as required. Then set about deciding which install you wish to keep and wish are going to be deleted.

Obviously one of the install will be from RPM, so you shouldn't delete that by hand. Use the package manager. And don't of course delete any data_dir's or logs without checking their contents first.

Dan Carley
  • 25,189
  • 5
  • 52
  • 70