Due to the rapid development of low earth orbit satellite constellations, e.g., Starlink, OneWeb, etc., integrated satellite-terrestrial networks have been viewed as a promising paradigm to globally provide satellite internet services for users. However, when the contents from ground data centers are provided for users by satellite networks, there will be high capital expenditures in terms of communication delay and bandwidth usage. To this end, in this paper, a cooperative-caching and resource-allocation problem is investigated in integrated satellite–terrestrial networks. Popular contents, which are cached on satellites and ground data centers, can be accessed via inter-satellite and satellite–terrestrial networks in a cooperative way. The optimization problem is formulated to jointly minimize the deployment costs of storage resource usage and network bandwidth consumption. A cooperative caching and resource allocation (CCRA) algorithm based on a neighborhood search is proposed to address the problem. The simulation results demonstrate that the proposed CCRA algorithm outperforms Greedy and BFS in reducing the deployment costs.