First, perform a backup using the LMS backup interface (either through the GUI or using backup.pl from the CLI). Then just uninstall LMS as you would normally. When the uninstall completes, remove the leftover NMSROOT directory (e.g. /opt/CSCOpx on Solaris or C:\PROGRA~1\CSCOpx on Windows).
Then reinstall the new LMS. If this is the same version as was on there previously, then once you have LMS reinstalled and patched back to the previous level, then restore your previously taken backup. If this is a newer version, once that version is installed, then restore your backup.