I believe you must purchase a copy of Snow Leopard. You cannot use an install disc from a different Mac. Apple does not allow that. My iMac came with Tiger DVDs, but a mistake was made and they were not for my machine and did not work. You can purchase Snow Leopard from The Apple Store for $19.99 with free shipping. Apple is also selling Lion at the Store. It is clearly noted Lion needs 2 GB RAM.
I have a 20 inch iMac with 2 GB RAM - 250 GB HD - 2.0 GHz Core 2 Duo - 2007 (7,1 model)
I have Snow Leopard on DVD and Mountain Lion purchased from the App Store before the release of Mavericks. You must upgrade the RAM or purchase and install Snow Leopard. You could continue to run Leopard, but Apple is not supporting it.
My iMac came with an upgrade DVD for Leopard, which had a minimum RAM requirement of 512 MB.
I originally had just 1 GB RAM and Leopard was fine. With the 2 GB I have now, Snow Leopard is faster. I get spinning wheels with Mavericks, but it did install without issue. I am currently using 1.9 GB of RAM according to Activity Monitor.
You are perhaps in a situation like mine. The machine has some age to it. Any money spent is at your own risk. I would not want to spend money on my iMac if it suddenly failed.
You have options. Staying with Leopard is not a great idea. If you do, at least update it. Snow Leopard is still being supported, but that could change with the release of the next OS from Apple. That will work on your iMac without getting more RAM, but not as efficiently. You could purchase more RAM and 4 is a better suggestion than 2. Purchase either Snow Leopard or Lion on DVD from the Apple Store. Snow Leopard may not be as decent a choice, in my opinion. It needs to be updated before you can get to the App Store to download Mavericks, which isn't necessary with Lion.
A friend of mine has the same iMac as you and is running Mavericks with 4 GB RAM. Works fine.
Ok so i just tried and failed to install! So i picked up a snow leopard CD from a buddy who has a 2009 21-inch iMac, the mid-2007 iMac i have is 24-inch running 10.5.1, and has 2.4 ghz intel core 2 duo with 1gb 667 MHz DDR2 SDRAM. When I install the CD it brings up the menu, I click the install now button and get this error "Mac OS X Snow Leopard cannot be installed on this computer", what should I do? Is their a way i can boot from CD (like windows) and just format the drive to do a clean install??