Consider a wireless network formed by fixed or mobile nodes. Each node seeks to estimate its own position based on noisy measurements of the relative distance with other nodes. In a centralized batch mode, positions can be retrieved (up to a rigid transformation) by applying Principal Component Analysis (PCA) on a so-called similarity matrix built from the relative distances. In this paper, we propose a distributed on-line algorithm allowing each node to estimate its own position based limited exchange of information in the network. Our framework encompasses the case of sporadic measurements and random link failures. We prove the consistency of our algorithm in the case of fixed sensors. Our numerical results also demonstrate the attractive performance of the algorithm for tracking the positions of mobile sensors. Simulations are conducted on a wireless sensor network testbed.