Remove old version of Apache before installing new one

Q I need to install Apache and mod_ssl, but the tutorial says that first I have to get rid of the Apache version that is there already. It was put there by hand from source. Given that I can probably find the install directory (and then delete it), what else is it that makes Linux aware of an app, in the same way that Windows has a registry where you can clear stuff from? I have managed for the last two years by only uninstalling stuff I put on my Linux box with apt, so there is loads of junk that I need to clear!

A When you install software from source, it generally installs into /usr/local, unless you specify an alternate location with the --prefix switch. Apache, for example, will install into /usr/local/apache, so simply deleting this directory will purge Apache from your system. Linux has no registry, although for services that start at boot time, /etc/init.d contains the scripts that are used when switching between various run levels. Software installed from source generally will not change anything in /etc/init.d, but will often distribute sample init.d scripts that you can install manually.

You can also often do a make uninstall from the source code directory, which should remove binaries, configuration files and libraries installed. However, not all applications provide this, so it requires a little brain-work to hunt code down and delete it manually. It's often a good idea to use dpkg and rpm, depending on which distribution is used, to establish if a file is connected with a package, so you can see if httpd' is actually provided by a package or is just floating around. Unfortunately, since there is no record of things you install manually, if you install it in /usr and it mixes with package-based code, the best option is often just to force an install of the package over the top and clean up after it. Starting off on the right foot with a source install, such as installing it in /usr/local/<package>, is a good idea, so that once you're done with it you can just rm the directory.

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar