First, this is a decent informed answer as far as I think, just because of the stuff I have dealt with over the years and a couple motor swaps I have been a part of.
If I were to do this kind of a mod on a compac with its keel style like it is I would go the way of the Menger Cat boats.
What skip is saying is way overkill........ Sorry Skip.
You would use a small shaft, length obviously determined by the available space. The place to set the engine up would be in the bilge, exiting out the rear with a fiberglass tube, faired into the hull and keel to allow the space needed.
By placing it directly in front of the rudder, you will get better performance due to its ability to push water across the rudder for decent steerage.
ISSUES: Reverse is a real pain in the A$$. but companies do offer adjustable props so that you can offset some forward for some reverse, or that they change into another position that better facilitates reverse.
Materials to do the whole job would be low, primarily depending on its placement...... the engine size can vary roughly last I had seen them, and one needs to have 2 batteries to support just that engine because at any time the possibility of blowing out a sail needs to be thought of. Great thing that sailboats have 2 engines in a sense....
To do the tube, and that area, you are looking at a packing gland, cutlass bearing (of which gets glassed into the tube), shaft, prop, and the motor, then it all has to be wired accordingly.
To do the epoxy work, I would say about 2 gallons if using West System epoxy, Plenty of Fiberglass tape, and something on the order of 10 X 40 grit discs and probably 15 X 80 grit discs. Gallon to gallon and a half of Interlux 2000 to seal the works up from the water and bottom paint of choice.
I would guess one might have somewhere in the order of 30 to 40 hours in construction and more for design once parts were chosen.
The other way is to come out of the hull somewhere and exit at a angle to the rudder, which would require a Fiberglass tube, connected to the packing gland, the shaft exits going to a custom rudder skeg which houses the cutlass bearing.
Even more work than what I first talked of.....
A costly venture for sure...... and I am not real sure for me, after being around boats for this long, that it is worth the conversion for such small gains, but possibly even bigger losses......
I do like the outboards, for their ability to turn and aid the rudder control.
And actually, this begs to ask, what is the rudder on your boat? Foiled or just the aluminum plate? Maybe your in need of better steering control to aid in a more responsive boat to use in conjunction with the 25's hull, as I am sure windage is a issue when docking (hell, it is for me on the 19, and although we did really well last year ((only 2 X 1 foot long marks on the boat side)) I still know I could do better)
Anyway, It is totally doable, but If I were you, talk to some gusy with Catalina 30s and that sort of boat, the shaft and such is usually linear on them, they would be able to describe what it is like docking and such........
Still begs the question, what rudder do you have?