How to install El Capitan on an SSD before installing in old iMac
I'm trying to breathe new life into my late 2009 iMac. The HD finally died and I bought an SSD upgrade kit from iFixit.com. I understand I have to format and partition the SSD before I install it, and I can do that using my MacBook Pro.
My question is, when (and how) do I install OS X El Capitan onto the SSD? All the instructions I've found say to download El Capitan from the App Store, and that it will save the installer to Applications, which can then be installed on the SSD via command line. But the only link I've been able to find for El Capitan just saves a DMG file to my Downloads Folder.
I'm not sure what to do with that, or how to get it from the DMG in Downloads into an App in the Applications folder. Obviously I don't want to install El Capitan on my new MacBook Pro, I just want to use my MacBook to set up the SSD with El Capitan before I install it into the 2009 iMac.
If I double-click on the El Capitan DMG file, will it ask me where I want to install El Capitan (and will I be able to select the newly formatted SSD?) or will it automatically try to install it on my MacBook?
iMac, macOS 10.12