I know elevation is calculated starting from sea level, so how did they do it especially if there wasn't any sea around to serve as a base point?
First, how can you measure the difference in heights between two points? If you can measure the distance between the two points with sufficient accuracy, you just need to measure the angle of elevation of one point as seen from the other. The rest is trigonometry: height/distance = sin(angle), assuming you have measured the straight line distance (and tan(angle) if you measured the horizontal distance over level ground). This is difficult to do with mountains - how can you measure the distance?
Thus, second: how can you measure the height without knowing the distance to the 2nd point? You can measure two angles of elevation, from two points a known distance apart. The trigonometry is a little more complicated, and you have to take into account any difference in elevation between your two reference points. For accuracy, you want your two reference points to be a long way apart, which can make it harder to measure the distance between them, but you can use a similar trigonometric procedure to measure that distance (i.e., triangulation), by measuring the change in bearing from the two reference points. The standard modern pre-electronics, pre-satellite, pre-laser instrument for such measurements (both angles of elevation and bearing) is the theodolite. (It's possible to make measurements with ancient instruments, as available to, e.g., the ancient Greeks, but errors in the measured heights of mountains can then exceed 20%.)
If you don't have nearby sea, the best you can do locally with this kind of surveying is measure the height relative to your reference point. But you can measure the elevation of some other suitable reference point (such as another mountain), and find the difference in heights. Then measure that reference point relative to another, and so on, until you reach the sea. If the mountain is a long way inland, you will need many reference points. For the network of reference points in the Great Trigonometrical Survey of India which led to the first measurements of the heights of Mount Everest (named after George Everest, who was the second superintendent of the Survey) and other Himalayan peaks, see https://commons.wikimedia.org/wiki/File:1870_Index_Chart_to_GTS_India-1.jpg There is a chain of approximately 30 reference points from Mount Everest to Calcutta; the closest reference points to Everest are quite a long way away - over 100 miles - because the surveyors weren't allowed to enter Nepal. To make up for this, the elevation (and distance) was measured from multiple reference points, so as to be able to reduce measurement errors by averaging.
For a history of the Survey of India, see Strahan, C. (1903), "The Survey of India", Professional papers of the Corps of Royal Engineers 28, 141-171: https://archive.org/stream/professionalpape28grea#page/n211/mode/2up
It was possible (pre-laser etc) to make an approximate measurement of the elevation of an inland mountain without needing a chain of reference points to the sea, by measuring the air pressure. This can be done directly by using a barometer, or indirectly by measuring the boiling point of water. Early measurements with barometers, in the 18th century could be 20% in error - comparable with the better ancient Greek instruments, but 19th century measurements were better (but the limit appears to be about 1%, since the air pressure fluctuates). While not as accurate for, e.g., determining the height of Everest compared to trigonometric methods, it would have been a much faster and cheaper method (assuming one was allowed into Nepal, and could climb to the top of the mountain!).
For a history of measuring the heights of mountains, beginning with ancient Greek measurements, and continuing with early modern measurements (but stopping many decades short of the laser-and-satellite age), see Cajori, F. (1929), History of Determinations of the Heights of Mountains, Isis 12(3), 482-514: http://www.jstor.org/stable/224470 (or http://penelope.uchicago.edu/Thayer/E/Journals/ISIS/12/3/Determinations_of_Heights_of_Mountains*.html if you prefer it over JSTOR).
For some brief details of the history of Chinese measurement of heights of mountains, see Needham, J. and Wang Ling (1959), Science and Civilisation in China Vol. 3. Mathematics and the Sciences of the Heavens and Earth, Cambridge University Press. (Needham writes a lot about surveying and cartography, but only a little about the surveying of mountains.) For a nice picture of a method for measuring the height of a mountain (relative to a reference point), known by the end of the Han Dynasty: https://commons.wikimedia.org/wiki/File:Sea_island_survey.jpg