The normal state of optimally doped cuprates is dominated by the "strange metal" phase that shows a linear temperature ($T$) dependence of the resistivity persisting down to the lowest $T$. For underdoped cuprates this behavior is lost below the pseudogap temperature $T^*$, where Charge Density Waves (CDW) together with other intertwined local orders characterize the ground state. Here we show that the $T$-linear resistivity of highly strained, ultrathin and underdoped YBa$_2$Cu$_3$O$_{7-\delta}$ films is restored when the CDW amplitude, detected by Resonant Inelastic X-ray scattering, is suppressed. This observation points towards an intimate connection between the onset of CDW and the departure from $T$-linear resistivity in underdoped cuprates. Our results illustrate the potential of using strain control to manipulate the ground state of quantum materials.