Compact stars have been perceived as natural laboratories of matter at an extremely high density. The uncertainties of the equation of state (EOS) of matter can be constrained by observing compact stars. In this review, we investigate the EOSs, global structure, and elastic properties of compact stars. We focus in detail on how to constrain the above properties of compact stars via asteroseismology. Observations that include studies of quasi-periodic oscillations from giant flares of soft gamma-ray repeaters and gravitational waves provide information about the elastic properties and internal compositions of compact stars.