If you are moving it to a newer Mac:
iTunes: How to move your music to a new computer:
http://support.apple.com/kb/HT4527?viewlocale=en_US
If you are moving it to an external HD:
Our iTunes guru Terence Devlin advises the following:
1. Quit iTunes
2. Drag the iTunes folder from your internal hd - located in ~/Music folder - to your external hd. DO NOT delete the original one from your internal hd... yet!
3. When the transfer is complete, press and hold the Option(alt) key and fire up iTunes.
4. A "Choose iTunes Library" window will come up. Click on the "Choose Library" button.
5. Navigate to where the iTunes folder is located in the external hd.
6. Within the iTunes folder, select the iTunes Library file and click Choose...
That's it. iTunes will now display all your playlists, songs, movies, podcasts etc. At this point, should you wish, you can delete the iTunes folder from the internal hd to free up space.
More info:
http://support.apple.com/kb/HT1751
Or if you prefer a more complicated explanation:
http://www.ilounge.com/index.php/articles/comments/moving-your-itunes-library-to -a-new-hard-drive
Similarly with iPhoto:
This is our resident iPhoto guru, Terence Devlin's, advice:
You can move your iPhoto Library to an external disk or new Mac:
1. Quit iPhoto
2. Copy the iPhoto Library Folder as an entity from your Pictures Folder to the External Disk.
3. Hold down the option (or alt) key while launching iPhoto. From the resulting menu select 'Choose Library' and navigate to the new location. From that point on this will be the default location of your library.
4. Test the library and when you're sure all is well, trash the one on your internal HD to free up space.