The earliest libraries were established in remote antiquity. Vast collections of "books" written on clay tablets have been discovered in the ruins of Ninevah and in Ancient Egypt, the priests maintained archives on papyrus. As learning and literacy increased, libraries became larger and more complex. The Great Library of Alexandria established in 300 BC was one of the largest and most significant libaries of the Ancient World and had teh lofty goal of incorporating copies of every book published in the world. Its scribes and agents scoured the book markets of the ancient world for copies of manuscripts and ships regularly brought cargoes of precious books to the port of Alexadria.
The collapse of the Roman Empire was a dark time of libraries and learning in general. When the moslems took Alexandria they burned all of the books in the Great Library, and it is said that the baths of the city were heated for months using the bonfires of the ancient manuscripts. In Europe, the destruction of the ancient cities and the disruption of the old society brought in a Dark Age in which knowledge was lost. What remained was preserved largely in small monastery libraries. The few books that remained were meticulously copied by monk scribes.
These monastic workshops and book presses were to form the nucleus from which the spark of civilization was to begin again. As more books were produced they began to be assembled in rudimentary libraries, often affiliated with larger monastaries or universities such as the Sorbonne.
Before the printing press, monks and scribes laboured for months and even years to copy and produce a single book. Each book was a handcrafted work of art, usually written on vellum and decorated with beautiful illustrations. Because the materials for producing books was in short supply, these masterpieces of medieval bookmaking were sometimes recycled by erasing the original text and writing over it. In some cases the original writing can e rediscovered using modern techniques, which allows the few surviving medieval books to serve as double treasures.
Because books were so rare and valuable, Medieval libraries were different than what we are familiar with today. The books were usually chained to shelves or reading carels. However in 1212 a religious council in Paris decreed that monastic libaries should lend books because lending was an important act of mercy. However libraries were still fearful of the loss of their precious books and so would only lend a book if the borrower provided a large security deposit or a book of equal value.
Despite the many quaint differences between medieval libraries and those of the present day, medieval libraries created the foundation for what we are familiar today including the system of lending books, classification and indexing systems, and the practice of putting books on shelves (in contrast to the ancient method of putting papyrus rolls in tubes). Most importantly these small lights of knowledge grew into the great libraries that would fuel the glory of the Renaissance and shape our modern world.