Recently, linear codes with a few weights have been constructed and extensively studied due to their applications in secret sharing, authentication codes, association schemes, and strongly regular graphs. In this paper, we construct several classes of linear codes with a few weights over IFp, where p is an odd prime. The weight distributions of these constructed codes are also settled by applications of the theory of quadratic forms and Gauss sums over finite fields. Some of the linear codes obtained are optimal or almost optimal. The parameters of these linear codes are new in most cases. Mor...