The rapid development of wireless communication and sensor technology provides an infinite possibility for extending the inherent function of civil structures through various methods. As an important branch of wireless communication technology, UWB technology has the advantages of strong anti-interference ability, high multipath resolution, and can provide decimeter level positioning accuracy. Based on this, we design and implement an indoor positioning system based on UWB wireless communication technology, and propose an improved least squares (ILS) algorithm to verify the performance of the system. The system adopts star network topology, which consists of one target node (TN) and several anchor nodes (ANs). In the process of positioning, the TN communicates with all the known ANs by polling. In this process, the respective receiving and sending timestamps are obtained, after unified collection and then convert it to the distance between the TN and each ANs. Finally, the location of the TN is achieved by the algorithm of the host computer. The ILS algorithm obtains more positioning results and more accurately reflects the position of the TN after solving the arithmetic mean. Experiments on a large number of different scenes to verify the stability of the system and prove the effectiveness of the ILS algorithm. In a word, the system realizes the acquirement of the target position information in the building space and improves the intelligence of the civil structure.