First of all it is recommended in the scriptures that one marries and begets son.
The following Aitreya Brahmana 7.13 verses quoted in the Vashishta Dharma Sutras make that explicit:
‘A debt he pays in him and immortality he gains, the father who sees
the face of his son born and alive’ (AB 7.13).
2 ‘Eternal are the worlds of those men who have sons. A sonless man
has no world’––so states a vedic text (cf. AB 7.13).
A man is born with three debts of which the particular debt that he has to his ancestors is cleared only when he procreates a son.
Manu Smriti 6.35. When he has paid the three debts, let him apply his
mind to (the attainment of) final liberation; he who seeks it
without having paid (his debts) sinks downwards.
6.36. Having studied the Vedas in accordance with the rule, having begat sons according to the sacred law, and having offered sacrifices
according to his ability, he may direct his mind to (the attainment
of) final liberation.
6.37. A twice-born man who seeks final liberation, without having studied the Vedas, without having begotten sons, and without
having offered sacrifices, sinks downwards
In case when one has married but does not have a son, he has the option of making his daughter a Putrika - the appointed daughter in the following manner.
9.127. He who has no son may make his daughter in the following manner an appointed daughter (putrika, saying to her husband), ’The (male)
child, born of her, shall perform my funeral rites.
Prajapati Daksha, who had only daughters, employed this technique.
Therefore, marriage is always recommended and if one does not have a progeny then he can adopt son who is equal to a real son in many regards.
A natural son, a son begotten on the wife, a son given in adoption, a
contrived son, a son born in secret, and a son adopted after being
abandoned by his birth parents––these share in the inheritance.
Gautama Smriti 28.33
For persons who do not intend to marry the options seem to be to become a Sannyasi or follow the life of a Naishthika Brahmachari ( a perpetual student).
Manu Smriti 2.247. (A perpetual student) must, if his teacher dies,
serve his son (provided he be) endowed with good qualities, or his
widow, or his Sapinda, in the same manner as the teacher.
2.248. Should none of these be alive, he must serve the sacred fire, standing (by day) and sitting (during the night), and thus finish his
A perpetual student is the one who lives till he dies in the Brahmacharya Asrama. He is not required to marry.