Databook!! Rough English translation of Kaguya's history:
Ever since "humans" were given form, they have fought each other and walked in a world of war. The earth was stained with blood, and as if it were absorbing that blood for nourishment, the Shinju took root in the earth. Eventually the Shinju beared a single fruit, and a certain clan came from another world seeking that fruit: the Ootsutsuki clan. Kaguya, leader of the Ootsutsuki, ate the fruit and became the progenitor of all chakra, and with her absolute power brought peace to the world in an instant.
After ending the turbulent era, she became known as the Rabbit Goddess and received the blessing of the people, giving birth to twins. But after that, Kaguya would occasionally use harsh means to rule the people as a dictator. The Byakugan, Sharingan, and Infinite Tsukuyomi - the people feared and respected the jutsu Kaguya wielded. Eventually, the "Rabbit Goddess" became known as a demon instead. And then, Kaguya became ruled by her desire to make all chakra her own.
To make all chakra one - Kaguya's desire eventually turned on Hagoromo and Hamura, her own twin sons with whom she had split her chakra. Kaguya formed a plan, and in order to take in all chakra, fused with the Shinju and battled against her twin sons.
The twins, assuming that the Juubi was a transformed Shinju attacking them in order to reclaim the chakra that was taken from it, faced off against it. And after a fierce battle, they activated Rikudou Chibaku Tensei. They turned it into the moon and sealed it away.
Caption next to Hamura on the last page: The Gedou Mazou, the remaining shell of the Juubi, was sealed in the moon. Hamura took command of the clan to watch over the Mazou.