Historically, "semicha" -- the conferring of the title Rabbi -- was not
generally done through formal schooling, as became the norm in 20th
century America. In fact, the whole notion of yeshivas, or rabbinical
schools, as a training ground for rabbis is modern and Western
(specifically, Germany and then America). Even today, one can become an
Orthodox Rabbi through a private process of study and testing. See, for
instance, the Wikipedia entry for Zalman Nechemia Goldberg.
Tangentially, on the famous Lithuanian Yeshivas of the Nineteenth
Century, see the seminal work of Shaul Stampfer.