1660s, "state of being unmarried, voluntary abstention from marriage," formed in English, with abstract noun suffix -cy + Latin caelibatus "state of being unmarried," from caelebs "unmarried," a word of uncertain origin. Perhaps from PIE *kaiwelo- "alone" + lib(h)s- "living." De Vaan suggests as an alternative PIE *kehi-lo- "whole," which would relate it to health (q.v.): "[I]f this developed to 'unboundness, celibacy', it may explain the meaning 'unmarried' of caelebs-."
Originally and through the 19c. celibacy was opposed to marriage, and celibacy, except as a religious vow, often was frowned upon as leading to (or being an excuse for) sexual indulgence and debauchery among bachelors. By 1950s it was being used sometimes in a sense of "voluntary abstinence from sexuality," without reference to marriage.
Latin liber (from Proto-Italic *lufro-) was originally "the inner bark of trees," and perhaps is from PIE *lubh-ro- "leaf, rind," a derivative of the PIE root *leub(h)- "to strip, to peel" (see leaf (n.)). Comparing Albanian labë "rind, cork;" Lithuanian luobas "bast," Latvian luobas "peel," Russian lub "bast," de Vaan writes that, "for want of a better alternative, we may surmise that liber is cognate with *lubh- and goes back to a PIE word or a European word 'leaf, rind.'"
The equivalent word in most Romance languages survives only in the sense "bookseller's shop" (French libraire, Italian libraria). Old English had bochord, literally "book hoard." As an adjective, Blount (1656) has librarious.