Well, firstly I'd suggest backing up your library (.itl file) while it works with your music on the external.
If you're just looking to backup your library, that being the .itl file that iTunes uses to manage all your music, then I'd suggest just copying the file and placing it in the Previous iTunes Libraries folder, or somewhere safe.
If, as I presume is your actual intention, you want to backup your music files then you're going to need to move all of the folders of music into the iTunes Music folder within Music/iTunes. I'm assuming you have iTunes managing your music into folders according to its own rules, with the iTunes Music folder specified as being located on your external. If not then let me know.
The next step is to change the preferences in iTunes to let it know that the new location for your music will be on the iMac, presumably in Music/iTunes/iTunes Music - at this point your music files should still be on the external, though this would probably work if you've already moved them across. Also be sure that "Keep iTunes music folder organized" and "Copy files to iTunes Music folder when adding to library" are both checked, unless you have your own file management situation going in which case this method probably wont work.
Once you've changed the iTunes Music folder location in preferences, just go to Advanced and select Consolidate Library, and iTunes should automatically copy all of your music files across from the external to the mew location for the iTunes Music folder you specified in the prefs.
How much music do you have - this could take a while
Further advice here:
http://lifehacker.com/238296/ultranewb--how-to-move-your-itunes-library-to-an-ex ternal-drive