Marriage is recommended for the one who desires it and can afford it, and the one who cannot afford it should distract himself by fasting Sahih Muslim 1402 a

Arabic hadith text
وَحَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا عَبْدُ اللَّهِ بْنُ الْمُبَارَكِ، ح وَحَدَّثَنَا أَبُو كُرَيْبٍ، مُحَمَّدُ بْنُ الْعَلاَءِ - وَاللَّفْظُ لَهُ - أَخْبَرَنَا ابْنُ الْمُبَارَكِ، عَنْ مَعْمَرٍ، عَنِ الزُّهْرِيِّ، عَنْ سَعِيدِ بْنِ، الْمُسَيَّبِ عَنْ سَعْدِ بْنِ أَبِي وَقَّاصٍ، قَالَرَدَّ رَسُولُ اللَّهِ صلى الله عليه وسلم عَلَى عُثْمَانَ بْنِ مَظْعُونٍ التَّبَتُّلَ وَلَوْ أَذِنَ لَهُ لاَخْتَصَيْنَا ‏.‏
Translation
Sa'd b. Abi Waqqas (Allah be pleased with him) reported

The Messengger of Allah (ﷺ) rejected (the idea) of Uthman b. Muz'unliving in celibacy (saying): And if he (the Holy Prophet) had given me permission We would have got ourselves castrated.