From September 30, 1921 until July 2, 1931, he served as mayor () of Kaunas, the temporary capital of Lithuania. Under his direction Kaunas grew rapidly and became a truly modern city. A water and wastewater system, costing over 15 million Lithuanian litas, was put in place; the city expanded from 18 square kilometers to 40; more than 2,500 buildings were built, including three modern bridges over the Neris and Nemunas rivers. All the city streets were paved, horse-drawn transportation was replaced with modern bus lines, new suburbs were planned and built, and new parks and squares were established. The foundations for a social security system were laid, three new schools were built, and new public libraries, including the Vincas Kudirka library, were established. Vileišis maintained many contacts in other European cities, and as a result Kaunas was an active participant in European urban life.