The portal-scaffold complex is believed to nucleate the assembly of procapsids of herpesviruses. During capsid maturation process, two events occur: expulsion of the scaffold and the incorporation of DNA. The portal-scaffold interaction and the conformational changes to the portal during the different stages of capsid assembly and maturation have yet to be elucidated structurally. Here, we present high-resolution structures of the A- and B-capsids and in-situ portals of human cytomegalovirus. We show that scaffolds bind to the hydrophobic cavities formed by the dimerization and Johnson-fold domains of the major capsid proteins. We further show that 12 loop-helix-loop fragments, presumably from the scaffold domain of the scaffold, insert into the hydrophobic pocket of the portal crown domain. The portal also undergoes significant changes both positionally and conformationally accompanying DNA packaging. These findings not only provide insights into how the portal interacts with the scaffold proteins to nucleate capsid assembly but further our understanding of the mechanism of scaffold expulsion and DNA incorporation during maturation.