The major construction and initial-phase operation of a second-generation gravitational-wave detector, KAGRA, has been completed. The entire 3 km detector is installed underground in a mine in order to be isolated from background seismic vibrations on the surface. This allows us to achieve a good sensitivity at low frequencies and high stability of the detector. Bare-bones equipment for the interferometer operation has been installed and the first test run was accomplished in March and April of 2016 with a rather simple configuration. The initial configuration of KAGRA is called iKAGRA. In this paper, we summarize the construction of KAGRA, including a study of the advantages and challenges of building an underground detector, and the operation of the iKAGRA interferometer together with the geophysics interferometer that has been constructed in the same tunnel.