for RAM, yes it's quite easy.

not sure what model/year you have, but here's a tutorial for a 2008 imac

YouTube - How to install ram in a iMac (4gb)

replacing the hard drive is relatively simple too.

for processor, i'm sure it's doable but i don't think i'd recommend you do that, especially considering the tightly calibrated fan and cooling system (danger of overheating if you stuck a faster processor in there). that's a disadvantage to getting a compact computer.