Don't know how much internal space is necessary but I think they can squeeze the turret as is on a 052 series ship. May have to have a different layout from the 052C/D though.
Space should be a problem.
If there isn't enough space below the hull after removing all the conventional gun supports, then I think they can remove the conventional gun and in its place (taking up some more space to the fore of the ship if needed), build a structure to house the generators and other equipment needed for the rail-gun. Then, build the rail gun turret on top of the structure so that it's elevated compared to the original gun position. If they shape such a housing structure with a pyramidal leading edge (like the chin camera on J-20), it would be stealthy too!
Alternatively, they can move the turret position as much to the fore of the ship as possible, freeing up enough room behind it for a housing structure the size of those 3 containers seen on the testing ship in which to place all the rail-gun support systems. This solution may be less than ideal, though, as it would result in much greater recoil effect on the ship and stress on the hull when the turret fires to either side.
Both accommodations should be doable on the 052 hull and easy to do on the 055 hull.