errata's got it right. For the shrine to be built you must control the city that founded the religion (either you founded it or you took the city) and have a great prophet.
For the other religious buildings:
Temple - gotta have the appropriate tech (priesthood) and that religion in the city.
Monastery - gotta have the tech (meditation) and that religion in the city.
Cathedral - gotta have the techs (priesthood and music), that religion in the city, a temple in that city, and at least three of that temple somewhere in your empire per cathedral.