The establishment of latency is an essential step for the life-long persistent infection and pathogenesis of Kaposi s sarcoma-associated herpesvirus (KSHV). While the KSHV genome is chromatin-free in the virions, the viral DNA in latently infected cells has a chromatin structure with activating and repressive histone modifications that promote latent gene expression but suppress lytic gene expression. Here, we report a comprehensive epigenetic study of the recruitment of chromatin regulatory factors onto the KSHV genome during the pre-latency phase of KSHV infection. This demonstrates that the KSHV genome undergoes a biphasic chromatinization following de novo infection. Initially, a transcriptionally active chromatin (euchromatin), characterized by high levels of the H3K4me3 and acetylated H3K27 (H3K27ac) activating histone marks, was deposited on the viral episome and accompanied by the transient induction of a limited number of lytic genes. Interestingly, temporary expression of the RTA protein facilitated the increase of H3K4me3 and H3K27ac occupancy on the KSHV episome during de novo infection. Between 24-72 hours post-infection, as the levels of these activating histone marks declined on the KSHV genome, the levels of the repressive H3K27me3 and H2AK119ub histone marks increased concomitantly with the decline of lytic gene expression. Importantly, this transition to heterochromatin was dependent on both Polycomb Repressive Complex 1 and 2. In contrast, upon infection of human gingiva-derived epithelial cells, the KSHV genome underwent a transcription-active euchromatinization, resulting in efficient lytic gene expression. Our data demonstrate that the KSHV genome undergoes a temporally-ordered biphasic euchromatin-to-heterochromatin transition in endothelial cells, leading to latent infection, whereas KSHV preferentially adopts a transcriptionally active euchromatin in oral epithelial cells, resulting in lytic gene expression. Our results suggest that the differential epigenetic modification of the KSHV genome in distinct cell types is a potential determining factor for latent infection versus lytic replication of KSHV.