1

I have at least 5 development servers (dev, QA, staging) that have php and other packages compiled from source. I would like to remove all of them and update those servers with yum packages. If I can do that via puppet or chef that will be great. So:

  1. How do I start looking for packages that are self compiled and remove them ?
  2. Later install the updated version of the same packages via yum in the server?
  3. Is puppet/chef is a good option to use to simulate the changes in the servers ?
Maz
  • 21
  • 2

3 Answers3

0

How do I start looking for packages that are self compiled

There isn't really a good way to guarantee you'll get them all

  • Consult your config documentation.
  • Consult your build documentation.
  • Look in the usual places (/usr/bin, /usr/local/bin etc)

but there isn't really a good way to guarantee you'll get them all

and remove them

This is non trivial unless the package came with a way to remove itself. You could try recompiling the packages and then reinstalling them using a chroot or if a DESTDIR= drective

mkdir /tmp/package
make && make install DESTDIR=/tmp/package

Then look at the contents of the /tmp/package or chroot tree to get a filelist which can then be used to delete the files from the main filesystem tree. This is though dependent on you knowing the options you used to configure the build.

Later install the updated version of the same packages via yum in the server?

yum install packagename

Is puppet/chef is a good option to use to simulate the changes in the servers ?

Your best solution at this point is to start again. Choose a config management solution and use it to build consistent systems

Install your base OS then

  • Use your config management solution to add and configure packages
  • Run your tests
  • If tests fail
    • Work out why
    • update configuration management
  • rinse and repeat until tests pass
user9517
  • 115,471
  • 20
  • 215
  • 297
-1

unfortunately it is not very easy to clean such a situation. Anyway, to the following:

  1. do a list of what you think was manually installed, it will be useful
  2. self-compiled packages generally are in /usr/local, /opt and other non-default directories. Have a look on these directory to see what was manually installed
  3. after manual installation discovery, install via yum/rpm the official packages. They will be installed in /bin, /usr/bin and other default directories, so they should be the preferred program when invoking the executable (eg: /usr/bin/php should be preferred to /usr/local/bin/php). Anyway, check you PATH variable
  4. remember that the official packages will install different (probably older) version of the affected software. If your applications depend on specific package version, they can have problems (eg: if you use a recent Joomla installation, be aware that it need at least PHP 5.3.10+, while the CentOS-provided one is at 5.3.3)
  5. I would not use automatic configuration script/methods to execute this activity. It really need manual intervention, at least of the first servers.
shodanshok
  • 47,711
  • 7
  • 111
  • 180
-2

Provided you have the compiled sources still around (I tend to keep them myself) a lot of today's packages support the uninstall target. Just make uninstall and hopefully the right files will be deleted. If you don't have them around, recompile them and install, then uninstall. Just make sure you have the same version.

If this does not work, you might want to try installing the distros packages, and use rpm to manually hunt for files, that do not belong to any package. Just make sure all previous files get overwritten.

Konrad Gajewski
  • 1,518
  • 3
  • 15
  • 29