The Recovery Mac OS on these older Macs have a version of the installer which contains expired certificates. Apple has since posted updated installer apps with valid certificates. You need to download Mac OS installer app from Apple and create USB install media, boot from it, and install Mac OS. There are many blog posts, YouTube videos, and forum threads covering how to download and create USB install media for Mac OS.