- Backup the library with this User Tip.
- Deauthorize the computer before you wipe it
- Restore the backup to your new computer using the same tool used to back it up.
- Install iTunes
- Keep your backup up-to-date in future.
Note if you have iOS devices then you should back up any contacts and calendar services that you sync. Alternatively you should create one dummy entry of each in your new profile and iTunes should merge the existing data from the device.
If your media folder has been split out from the main iTunes folder you may need to do some preparatory work to make it easier to backup and restore to any location. See make a split library portable.