You can download the genuine OS X Yosemite installer directly from Apple's support servers using a web browser.

Go to your Applications folder and run . 4. Optional: Create a Bootable USB

The DMG file is an Apple Disk Image file. It acts as a digital copy of a physical disc, containing the full installation files for the operating system. You might need this specific version to:

Select if you want to wipe your current drive for a clean installation, or select Install OS X to upgrade your existing OS directly. Troubleshooting Common Download and Installation Errors

Once formatted, open Terminal (located in /Applications/Utilities/ ).

To use your newly created bootable USB drive to upgrade or perform a clean install: Shut down the target Mac completely. Insert the bootable USB installer into a USB port.