Failure to install an operating system is usually caused by (in order of probability):
1. You are attempting to install with other devices connected to the computer. Disconnect them before trying to do an installation.
2. Faulty installation media. Check the installation CD/DVD for scratches, smudges. Test in another machine.
3. Faulty optical drive. Test with another bootable CD/DVD or swap it out for a known-working one.
4. Faulty RAM. Test with Memtest86+ from www.memtest.org . You will download the .iso to make a bootable cd. Burn the file with third-party burning software* - as an image, not as data. Then boot with the media you made (you may need to change the boot priority in your BIOS so that the optical drive is the first boot device). The test will run immediately. Let the test run for an hour or two - unless errors are seen immediately. If you get any errors, replace the RAM.
It is not necessary to have third-party burning software in Windows 7 since Win7 can natively burn an .iso. Other operating systems require it. A good free choice is ImgBurn from www.imgburn.com .
5. Faulty hard drive. Test with a diagnostic utility downloaded from the drive manufacturer website. You will create a bootable CD with the file you download. Burn the file with third-party burning software (unless you have Windows 7, which can burn .isos natively) - as an image, not as data. Boot with the CD you made and do a thorough test of the drive. If it fails any physical tests, replace it.
6. Other hardware components are faulty.
It's more than likely a scratched, smudged disk or failing / failed optical drive than the RAM or HD. But these are all steps that you can try for troubleshooting.