A Royal Navy flagship has left Portsmouth with supportive residents gathering to watch her leave.