Earlier quoted context omitted.
The moon has water ice in dark craters, as well as minable ore that contain aluminum, iron, silicon and oxygen. You will "just" need to use heavy mining and smelting gear to extract it. Solar power and batteries should work assuming you're willing to build your base among the "peaks of [near] eternal light" which get sunshine nearly ninety percent of the time.
This is mostly true on Mars too except perhaps the eternal light part
Mars is better for solar power because you won't need nearly as much battery capacity, as you get light on a ~24 hour cycle same as Earth. The Moon with its slow rotation is much more challenging.