We present in full detail a newly developed formalism enabling density functional perturbation theory (DFPT) calculations from a DFT + U ground state. The implementation includes ultrasoft pseudopotentials and is valid for both insulating and metallic systems. It aims at fully exploiting the versatility of DFPT combined with the low-cost DFT + U functional. This allows us to avoid computationally intensive frozen-phonon calculations when DFT + U is used to eliminate the residual electronic self-interaction from approximate functionals and to capture the localization of valence electrons, e.g., on d or f states. In this way, the effects of electronic localization (possibly due to correlations) are consistently taken into account in the calculation of specific phonon modes, Born effective charges, dielectric tensors, and in quantities requiring well converged sums over many phonon frequencies, as phonon density of states and free energies. The new computational tool is applied to two representative systems, namely CoO, a prototypical transition metal monoxide and LiCoO2, a material employed for the cathode of Li-ion batteries. The results show the effectiveness of our formalism to capture in a quantitatively reliable way the vibrational properties of systems with localized valence electrons.