The rule when you use the not only ... but also ... construction is that the two strings where the ellipsis dots fall must be strictly parallel: what comes before not only must combine with what comes after but also to form an acceptable sentence:
**Students can acquire knowledge from not only educational institutions, but also many other ways.
So If from many other ways were idiomatic, your alternative would be acceptable. However, we don't do things from ways but in ways. Accordingly, to maintain parallelism, the prepositions must be moved inside the construction:
Students can acquire knowledge not only from educational institutions but also in many other ways.