I put together a page on backing up WeBWorK a while back:
That information is more geared toward regular backups, but the principles are the same.
Short version: if you back up the courses directory and the database, you should be able to drop them in to a fresh install of WeBWorK and pick up where you left off. It's sometimes a little complicated if you are restoring to a different version of WeBWorK.
Slightly longer version:
Theoretically all course-specific files should be stored in /opt/webwork/courses. Some course-specific temp files are created within subdirectories of /opt/webwork/webwork2, but these shouldn't be necessary for things to work as they did before.
Here are the basic steps I would take to migrate between servers:
- Do a mysqldump of the webwork database, and save it to a file.
- Make a tar archive of /opt/webwork/courses
- Build the new server and install WeBWorK from scratch (if the goal is to clean up, this will prevent you from carrying over any extra WeBWorK code and files)
- Restore the database from your mysql dump file
- Unpack the tar archive back into /opt/webwork/courses
You can instead archive the whole /opt/webwork directory, which will include your course files, the WeBWorK code and the problem libraries. This will guarantee that you are restoring the same version of WeBWorK that you were running before.
One big warning: though I have done this a couple of times (using the latter approach of archiving the whole /opt/webwork directory), I won't make any guarantees. I would highly recommend building a virtual machine and restoring to that to make sure that it works before wiping the live server and starting from scratch.