Unlink iPhone from a computer and switch to another
If any apps or music came preloaded on the phone, make sure you have copies in your iTunes library before starting.

Plug in the iPhone and start syncing as you normally would.  iTunes will ask whether you'd like to wipe the phone and sync with this computer instead.  Just say yes.